disabling triggers?

Started by Bob Parkinsonover 25 years ago2 messagesgeneral
Jump to latest
#1Bob Parkinson
rwp@biome.ac.uk

Hi,

I've noticed the recent query about dropping a function with a trigger.

I've got a trigger/function pair that I need to disable while I do a
manual update. Is it safe to drop the trigger, then re-create it on its
own, or should I do the trigger/function pair.

Is there a better method of temporarily disabling a trigger?

Cheers,

Bob

Bob Parkinson
rwp@biome.ac.uk
------------------------------------------------------------------
Technical Manager: Biome http://biome.ac.uk/

Greenfield Medical Library,
Queens Medical Centre,
Nottingham. 0115 9249924 x 42059
------------------------------------------------------------------
We are stardust

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bob Parkinson (#1)
Re: disabling triggers?

Bob Parkinson <rwp@biome.ac.uk> writes:

I've got a trigger/function pair that I need to disable while I do a
manual update. Is it safe to drop the trigger, then re-create it on its
own, or should I do the trigger/function pair.

Dropping the trigger seems sufficient. Dropping the function has at
least one big disadvantage: if the same function is supporting similar
triggers on other tables, dropping the function would break those
triggers.

Is there a better method of temporarily disabling a trigger?

You could reach in and hack the reltriggers field in pg_class,
but dropping and recreating the trigger seems a lot cleaner and
safer.

regards, tom lane