Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 0A48C9F9F11 for ; Tue, 21 Aug 2007 19:44:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 31495-06 for ; Tue, 21 Aug 2007 19:44:33 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from corp.etelos.com (corp.etelos.com [216.251.101.81]) by postgresql.org (Postfix) with ESMTP id 2353D9F9F0C for ; Tue, 21 Aug 2007 19:44:39 -0300 (ADT) Received: from [192.168.4.109] (unknown [216.251.108.82]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by corp.etelos.com (Postfix) with ESMTP id EEE67FAC29; Tue, 21 Aug 2007 15:44:36 -0700 (PDT) Message-ID: <46CB6AD1.6060600@etelos.com> Date: Tue, 21 Aug 2007 15:44:33 -0700 From: Jon Collette User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: Thomas Kellerer CC: pgsql-sql@postgresql.org Subject: Re: Make a SQL statement not run trigger References: <46CB5876.80003@etelos.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/178 X-Sequence-Number: 29116 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