From: | Terry Lee Tucker <terry(at)chosen-ones(dot)org> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Disable Triggers |
Date: | 2008-04-09 14:34:06 |
Message-ID: | 200804091034.06855.terry@chosen-ones.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)turbocorp(dot)com
www.turbocorp.com
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2008-04-09 14:34:14 | Re: connecting VB to postgreSQL |
Previous Message | Richard Huxton | 2008-04-09 14:22:16 | Re: select statement fails |