pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: Make a SQL statement not run trigger
Date: Wed, 22 Aug 2007 00:24:59 +0200
Message-ID: <fafonr$u84$1@sea.gmane.org> (raw)
In-Reply-To: <46CB5876.80003@etelos.com>
References: <46CB5876.80003@etelos.com>

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




view thread (8+ messages)  latest in thread

Message-ID: <fafonr$u84$1@sea.gmane.org>
Permalink:  ../fafonr$u84$1@sea.gmane.org/
Also on:    postgresql.org/message-id/fafonr$u84$1@sea.gmane.org

 · 

reply

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: spam_eater@gmx.net
  Subject: Re: Make a SQL statement not run trigger
  In-Reply-To: <fafonr$u84$1@sea.gmane.org>

* 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