Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 0E44B9FA00C for ; Tue, 21 Aug 2007 19:25:37 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 17890-05 for ; Tue, 21 Aug 2007 19:25:18 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id CCD909F9FDD for ; Tue, 21 Aug 2007 19:25:21 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1INc9s-0005CM-9h for pgsql-sql@postgresql.org; Wed, 22 Aug 2007 00:25:08 +0200 Received: from ppp-82-135-70-135.dynamic.mnet-online.de ([82.135.70.135]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Aug 2007 00:25:08 +0200 Received: from spam_eater by ppp-82-135-70-135.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Aug 2007 00:25:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Thomas Kellerer Subject: Re: Make a SQL statement not run trigger Date: Wed, 22 Aug 2007 00:24:59 +0200 Lines: 21 Message-ID: References: <46CB5876.80003@etelos.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: ppp-82-135-70-135.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.5) Gecko/20070716 Thunderbird/2.0.0.5 Mnenhy/0.7.5.666 In-Reply-To: <46CB5876.80003@etelos.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/177 X-Sequence-Number: 29115 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