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.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 59201e1cfb8e3e616b36c63ec51eec36decbc780
User & Date: drh 2013-10-19 15:17:50.254
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
Unified Diff Ignore Whitespace Patch
Changes to pages/lang.in.
1134
1135
1136
1137
1138
1139
1140























1141
1142
1143
1144
1145
1146
1147
the statement that caused the trigger program to execute and any subsequent
trigger programs that would of been executed are abandoned. ^No database
changes are rolled back.  ^If the statement that caused the trigger program
to execute is itself part of a trigger program, then that trigger program
resumes execution at the beginning of the next step.
</p>

























<tcl>
###############################################################################
Section {CREATE VIEW} {createview} {{CREATE VIEW} view *views}

BubbleDiagram create-view-stmt 1
</tcl>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
the statement that caused the trigger program to execute and any subsequent
trigger programs that would of been executed are abandoned. ^No database
changes are rolled back.  ^If the statement that caused the trigger program
to execute is itself part of a trigger program, then that trigger program
resumes execution at the beginning of the next step.
</p>

<tcl>hd_fragment temptrig {TEMP triggers on non-TEMP tables}</tcl>
<h3>TEMP Triggers on Non-TEMP Tables</h3>

<p>^(A trigger normally exists in the same database as the table named
after the "ON" keyword in the CREATE TRIGGER statement.  Except, it is
possible to create a TEMP TRIGGER on a table in another database.)^  
Such a trigger will only fire when changes
are made to the target table by the application that defined the trigger.
Other applications that modify the database will not be able to see the
TEMP trigger and hence cannot run the trigger.</p>

<p>When defining a TEMP trigger on a non-TEMP table, it is important to
specify the database holding the non-TEMP table.  For example,
in the following statement, it is important to say "main.tab1" instead
of just "tab1":</p>

<blockquote><pre>
CREATE TEMP TRIGGER ex1 AFTER INSERT ON <b>main.</b>tab1 BEGIN ...
</pre></blockquote>

<p>Failure to specify the database name on the target table could result
in the TEMP trigger being reattached to a table with the same name in
another database whenever any schema change occurs.</p>

<tcl>
###############################################################################
Section {CREATE VIEW} {createview} {{CREATE VIEW} view *views}

BubbleDiagram create-view-stmt 1
</tcl>