Documentation Source Text

Check-in [59201e1cfb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add discussion and cautions on the use of TEMP triggers on non-TEMP tables.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 59201e1cfb8e3e616b36c63ec51eec36decbc780
User & Date: drh 2013-10-19 15:17:50
Context
2013-10-19
15:21
Add documentation on the new SQLITE_USE_FCNTL_TRACE compile-time option. check-in: 67d47ef62f user: drh tags: trunk
15:17
Add discussion and cautions on the use of TEMP triggers on non-TEMP tables. check-in: 59201e1cfb user: drh tags: trunk
13:51
Merge the changes from the 3.8.0.x branch into trunk. check-in: 2faf39e6c4 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to pages/lang.in.

  1134   1134   the statement that caused the trigger program to execute and any subsequent
  1135   1135   trigger programs that would of been executed are abandoned. ^No database
  1136   1136   changes are rolled back.  ^If the statement that caused the trigger program
  1137   1137   to execute is itself part of a trigger program, then that trigger program
  1138   1138   resumes execution at the beginning of the next step.
  1139   1139   </p>
  1140   1140   
         1141  +<tcl>hd_fragment temptrig {TEMP triggers on non-TEMP tables}</tcl>
         1142  +<h3>TEMP Triggers on Non-TEMP Tables</h3>
         1143  +
         1144  +<p>^(A trigger normally exists in the same database as the table named
         1145  +after the "ON" keyword in the CREATE TRIGGER statement.  Except, it is
         1146  +possible to create a TEMP TRIGGER on a table in another database.)^  
         1147  +Such a trigger will only fire when changes
         1148  +are made to the target table by the application that defined the trigger.
         1149  +Other applications that modify the database will not be able to see the
         1150  +TEMP trigger and hence cannot run the trigger.</p>
         1151  +
         1152  +<p>When defining a TEMP trigger on a non-TEMP table, it is important to
         1153  +specify the database holding the non-TEMP table.  For example,
         1154  +in the following statement, it is important to say "main.tab1" instead
         1155  +of just "tab1":</p>
         1156  +
         1157  +<blockquote><pre>
         1158  +CREATE TEMP TRIGGER ex1 AFTER INSERT ON <b>main.</b>tab1 BEGIN ...
         1159  +</pre></blockquote>
         1160  +
         1161  +<p>Failure to specify the database name on the target table could result
         1162  +in the TEMP trigger being reattached to a table with the same name in
         1163  +another database whenever any schema change occurs.</p>
  1141   1164   
  1142   1165   <tcl>
  1143   1166   ###############################################################################
  1144   1167   Section {CREATE VIEW} {createview} {{CREATE VIEW} view *views}
  1145   1168   
  1146   1169   BubbleDiagram create-view-stmt 1
  1147   1170   </tcl>