From: Jon Collette <jon@etelos.com>
To: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Make a SQL statement not run trigger
Date: Tue, 21 Aug 2007 15:44:33 -0700
Message-ID: <46CB6AD1.6060600@etelos.com> (raw)
In-Reply-To: <fafonr$u84$1@sea.gmane.org>
References: <46CB5876.80003@etelos.com>
<fafonr$u84$1@sea.gmane.org>
Good Idea. However some of my triggers use the DELETE action as well.
So I can't use this method.
Thomas Kellerer wrote:
> Jon Collette wrote on 21.08.2007 23:26:
>> Is it possible to run an insert,update, or delete and have it not
>> launch a trigger like it normally would?
>>
>> For example could I set a value
>> DONOTRUN = True;
>> insert into contacts ....
>>
>> Where the trigger on contacts would call a function that would have
>> an IF statment for that DONOTRUN value?
>>
>> Or is there just a global variable I could set to disable triggers
>> and then reset it? And would that be a per connection variable?
>
> What we have done once, was to include a column in the table for this
> purpose. If a special value for the column was provided during UPDATE
> or INSERT, the trigger would immediately terminate, not doing any
> work. Thus the trigger still "fires" every time, but simply won't do
> nothing. Not very elegant, but worked for our environment.
>
> Thomas
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jon@etelos.com, spam_eater@gmx.net
Subject: Re: Make a SQL statement not run trigger
In-Reply-To: <46CB6AD1.6060600@etelos.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox