Subject Re: [firebird-support] Disable trigger?
Author Ann Harrison
On Tue, Mar 15, 2011 at 3:54 AM, Paul Vinkenoog <paul@...> wrote:
> "homerjones1941" wrote:
>
>> ... However, I don't need to log certain program-created updates. For example
>> certain fields are automatically updated each day for hundreds or even thousands
>> of records. ... Is there a way my stored procedure can disable a trigger, do its job,
>> and then re-enable?
>
>  execute statement 'alter trigger MyTrigger inactive';
>  ...
>  execute statement 'alter trigger MyTrigger active';
>
> You need EXECUTE STATEMENT to circumvent the no-DDL rule in PSQL.
>

Paul's answer is technically correct, but practically disastrous. Setting
a trigger to be inactive is a system-wide event and will stop other transactions
on other connections from logging their changes.


Good luck,

Ann