Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 1BF2E9FA086 for ; Tue, 21 Aug 2007 19:07:38 -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 21588-09 for ; Tue, 21 Aug 2007 19:07:25 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.187]) by postgresql.org (Postfix) with ESMTP id 278769FA087 for ; Tue, 21 Aug 2007 19:07:30 -0300 (ADT) Received: by rv-out-0910.google.com with SMTP id l15so1265821rvb for ; Tue, 21 Aug 2007 15:07:29 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ITYah0w8aZIDHeYO/ejIqpgDZp6K5lAHrLe9/nHSdK9/EDOxSOl1AYq3jNkCugc8nGGtzjt0M4YQ4N2jkr9HCRp61u03waCuFTryG1ohwdY43SUa1WOmseIXJKeIPBoeJKTyrF0IC/9SvP5YBCiETvPSN+mBK0eQJ5XbK9leFzI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VIl40L+AC7lUOaLod8vkyCC66h7D8P9Te3MDl1xiNojZ48F9dgVR+iawXgZxj0SB+5nLHwIcgOMYQnsTq74ygWynbleUf8ZmIy9r/jPYHQBvhGslQ+ojye/6scuJ5PFAIRkkqr2KPSaMZvZ6vR7NaK157bykIWWU/ei6znDjXzc= Received: by 10.141.210.5 with SMTP id m5mr3681168rvq.1187734049455; Tue, 21 Aug 2007 15:07:29 -0700 (PDT) Received: by 10.141.98.12 with HTTP; Tue, 21 Aug 2007 15:07:29 -0700 (PDT) Message-ID: Date: Tue, 21 Aug 2007 17:07:29 -0500 From: "Scott Marlowe" To: "Jon Collette" Subject: Re: Make a SQL statement not run trigger Cc: pgsql-sql@postgresql.org In-Reply-To: <46CB5876.80003@etelos.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <46CB5876.80003@etelos.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/176 X-Sequence-Number: 29114 On 8/21/07, Jon Collette wrote: > 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 .... The closest thing to a session variable for pgsql is going to likely be a temp table. you could have a temp table for each session that stores such things and the trigger looks in the temp table to see what to do. > 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? Yes, but that would open you up to race conditions. If another session wanted the trigger to fire it would not get it. Using a temp table would allow you to get around the race condition.