Re: Disable Triggers - Mailing list pgsql-general

From Andrew Sullivan
Subject Re: Disable Triggers
Date
Msg-id 20080221180543.GE18657@crankycanuck.ca
Whole thread Raw
In response to Re: Disable Triggers  (Terry Lee Tucker <terry@chosen-ones.org>)
Responses Re: Disable Triggers
List pgsql-general
On Thu, Feb 21, 2008 at 12:49:48PM -0500, Terry Lee Tucker wrote:
>
> Thanks for the input. I've been using the reltriggers in pg_class for a long
> time and it does work; however,  I did notice in the documentation on
> pg_trigger that tgenabled is not checked properly and using that will give
> inconsistant results. We have several valid reasons for disabling all
> triggers that I won't elaborate here.

I'm not arguing that you have those valid reasons.  I'm just warning you
that your success so far with this strategy does not guarantee future
results.

> Unless I get a better idea, I'm going to change the disable_triggers function
> to duplicate all the records in pg_trigger belonging to a given table, delete
> the records except for the Slony trigger, update pg_class setting reltriggers
> to 1, do the work, and then restore everything with a call to
> enable_triggers. Does this sound reasonable to you?

I expect you're going to have to get everyone to disconnect after that,
because the triggers oids will all have changed and you'll get errors to
that effect.  Also, are there these triggers on the slony replicas?  You
really need to be doing DROP TRIGGER/STORE TRIGGER operations if so.
Otherwise, very surprising things may happen.

A


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Disable Triggers
Next
From: Andrew Sullivan
Date:
Subject: Re: Disable Triggers