Re: Disable Triggers - Mailing list pgsql-general

From Terry Lee Tucker
Subject Re: Disable Triggers
Date
Msg-id 200804091237.24240.terry@chosen-ones.org
Whole thread Raw
In response to Re: Disable Triggers  ("Greg Sabino Mullane" <greg@turnstep.com>)
Responses Re: Disable Triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Disable Triggers  ("Greg Sabino Mullane" <greg@turnstep.com>)
List pgsql-general
On Wednesday 09 April 2008 11:00, Greg Sabino Mullane wrote:
> > I have a situation where an external process needs to disable the firing
> > of triggers on a table.
>
> ...
>
> > 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.
>
> You want: SET session_replication_role to 'replica';
>
> --
> Greg Sabino Mullane greg@turnstep.com
> PGP Key: 0x14964AC8 200804091058
> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

I see the following in the documentation for pg_trigger related to tgenabled:
"Controls in which session_replication_role modes the trigger fires. O =
trigger fires in "origin" and "local" modes, D = trigger is disabled, R =
trigger fires in "replica" mode, A = trigger fires always."

My question is: When tgenabled is set to "D", how does that setting interact
with session_replication_role and, is there a way to use tgenabled with a
setting of "D" to prevent a particular trigger from firing. Using ALTER TABLE
to disable the trigger won't work because the whole table is locked during
the transaction and I only want the disabled trigger to apply to the current
transaction in the current session.

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: "Francisco Figueiredo Jr."
Date:
Subject: Re: select statement fails
Next
From: Richard Huxton
Date:
Subject: Re: Quoting table/column names vs performance