Disable Triggers - Mailing list pgsql-general

From Terry Lee Tucker
Subject Disable Triggers
Date
Msg-id 200804091034.06855.terry@chosen-ones.org
Whole thread Raw
Responses Re: Disable Triggers  ("Greg Sabino Mullane" <greg@turnstep.com>)
List pgsql-general
Greetings:

I have a situation where an external process needs to disable the firing of
triggers on a table. I have two backend functions which handle this task:
disable_triggers ('table_name')
enable_triggers ('table_name')

These functions are called inside a transaction. The first, stores various
attributes of the triggers in a secondary table, then updates pg_trigger
setting tgenabled to 'D'. The second restores the value of tgenabled from the
secondary table and then deletes the records from the secondary table.

I can begin a transaction withing psql, issue: SELECT disable_triggers
('cust'), make an update to cust and the before and after triggers all fire
just like normal. I can do a \d cust inside the same transaction and the
triggers sections is listed with the heading: "Disabled Triggers". I can look
at the pg_trigger records associated with the cust table, and tgenabled is
set to "D", but the triggers still fire. session_replication_role is set to
"origin". I thought this was supposed to be fixed in later versions of
Postgres (I'm converting from 7.4.19 to 8.3.1), so apparently I'm missing
something.

Does anyone have any insight?

TIA
--
Terry Lee Tucker
Turbo's IT Manager
Turbo, division of Ozburn-Hessey Logistics
2251 Jesse Jewell Pkwy NE
Gainesville, GA 30501
Tel: (336) 372-6812  Fax: (336) 372-6812  Cell: (336) 404-6987
terry@turbocorp.com
www.turbocorp.com

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: select statement fails
Next
From: Richard Huxton
Date:
Subject: Re: connecting VB to postgreSQL