If runtime disablement of one or more whole triggers is desired, their
execution can be gated by adding a conditioned WHEN clause (or logical
conjuction with existing WHEN clause) to the offending trigger declaration.

https://sqlite.org/syntax/create-trigger-stmt.html

For example:

CREATE TRIGGER this_one ...etc...
WHEN NOT exists(SELECT name FROM disabled_triggers WHERE name='this_one')
BEGIN ...trigger body... END;

This example presumes a table called disabled_triggers which one manages at
runtime to name the trigger(s) to be temporarily disabled.



On Mon, Jul 17, 2017 at 1:12 AM, Clemens Ladisch <clem...@ladisch.de> wrote:

> Thomas Flemming wrote:
> > Is there a way in SQLite, to temporary disable and enable a trigger
> without dropping and recreating ?
>
> You could disable recursive triggers, and then make your triggers
> recursive by executing all your SQL statements through a temporary
> trigger on some temporary table.  But that would restrict what you could
> execute, and be more cumbersome than removing the actual triggers.
>
> What is the actual problem you're trying to solve?  If you have
> temporarily inconsistent data, it might be a better idea to deal with it
> in a temporary table.
>
>
> Regards,
> Clemens
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to