For non-TEMP triggers, the table to be modified or queried must exist
in the same database as the table or view to which the trigger is
attached. TEMP triggers are not subject to the same-database rule. A
TEMP trigger is allowed to query or modify any table in any ATTACH
<https://sqlite.org/lang_attach.html>-ed database.
But it doesn't seem to work this way yet. (3.19.3). Is this a coming change?
The <schema>.<table> syntax restriction (the fact that you can only
have <table> and not <schema>.<table> instead of triggers) is
universal.  It applies to both TEMP trigger and non-TEMP triggers.

Only the semantic rule that the referenced <table> must be within the
<same> schema is relaxed for TEMP triggers.

Right, I read too much into the second sentence.

Given the correct reading of the second sentence, I don't think the third sentence is quite true, depending on what "allowed" means. The TEMP trigger cannot modify just any table in any attached database. Specifically, a table with a namefellow in less recently attached databases or temp will be inaccessible for modifications.

Given the fact that table names are resolved using the normal rule whether they are modified or just queried in the trigger, what is the rationale for this syntactic restriction that applies specifically to the modification case? As far as I can tell, this leaves the programmer no way to disambiguate. Is there a good workaround?

Mark
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to