On Mon, Jul 4, 2016 at 12:08 PM, Hick Gunter <h...@scigames.at> wrote:
> Creating a trigger causes SQLite to insert a row into the sqlite_master > table which contains the text you supply for the trigger. No code is > generated at this time. You can verify this by creating a trigger that > references undefined fields. It willl succeed. But entering a statement > that references the trigger will fail with an undefined field error. > Any way to validate "statically" all triggers within a schema/db-file in one go? Using a pragma perhaps? Having to come up with statements to validate/compile all possible triggers seems error prone, no? > When preparing a statement, SQLite will check for any triggers defined on > the referenced tables, prepare the appropriate "trigger programs" and > insert calls to these in the original "statement program". > Thanks for the reminder. (which is new to me, since not used SQLite triggers yet). > A simple UPDATE <table> set <field>=<value> where <key_condition> will > translate into about 40 instructions; adding your trigger adds an > additional estimated 400 instructions of trigger program. > But the question is whether these extra VDBE instructions can cause slowdowns, even when not executed at runtime? (i.e. branch using them is not taken). Basically, triggers are compiled into the statements that MAY cause them to > fire; Never realized that all statements are bigger that way, but it makes sense in a server-less SQL engine like SQL, once you read it once. Thanks again for that insight. the WHEN clause is evaluated within the context of the trigger, even if the > trigger does not fire at all. What do you mean exactly by "within the context of the trigger"? What other context is there (that the one from the outer statement)? And can that context difference (?) expand different performance characteristics? Thanks, --DD _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users