Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9Yn3-0001yY-6F for pgsql-sql@arkaria.postgresql.org; Mon, 29 Jun 2015 13:08:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z9Yn1-0006iM-Eb for pgsql-sql@arkaria.postgresql.org; Mon, 29 Jun 2015 13:07:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z9Ylh-0005af-EZ for pgsql-sql@postgresql.org; Mon, 29 Jun 2015 13:06:37 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z9Yle-0000ul-79 for pgsql-sql@postgresql.org; Mon, 29 Jun 2015 13:06:36 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 294BF202FA for ; Mon, 29 Jun 2015 09:06:31 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Mon, 29 Jun 2015 09:06:31 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=Cl2e0UVVqrKpAFSHycPGSpDpTLU=; b=MQ1ZdO sw3EEzCijA+zezRBJ9WzB3el5vaZMg0RGLJ6L9zDr2GtnwlxSjQwkXKwzpVxJGlU tqf64OIfx4b3+T0zVnc+rKH7wnAASLTKPOzcTQ6z3B4q9b/Wu2nXyL0nxkNMpFGR zC1/wSjj2q8tsDWwJGNHjm8mfjcJJLDDzX3jw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=Cl2e0UVVqrKpAFS HycPGSpDpTLU=; b=mb1rOfaGjtZy4T1prWMqN4xKgsYjvtEmlTdrzdR25Zc3FC+ 2He+YviD3O+dMx/v8+zIblzvsXoSxbpNvWYwI0/96F5J2myDSB1Z5EOfCeWM3qoD /Q+h+mnqbHtJEBTAWKBtf/IgHHcViZbTFQR1PwMdEC2H0M0yZNJ/Xwh5VZM0= X-Sasl-enc: 0YxGODr4dq5RzT18Z1G8dbeElURr6GGtIwpx5kmbGUEg 1435583190 Received: from [192.168.1.2] (unknown [174.21.228.230]) by mail.messagingengine.com (Postfix) with ESMTPA id A9965C00295; Mon, 29 Jun 2015 09:06:30 -0400 (EDT) Message-ID: <559142D5.2080608@aklaver.com> Date: Mon, 29 Jun 2015 06:06:29 -0700 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: gmb , pgsql-sql@postgresql.org Subject: Re: Disable Trigger for session only References: <1435563798887-5855658.post@n5.nabble.com> In-Reply-To: <1435563798887-5855658.post@n5.nabble.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 06/29/2015 12:43 AM, gmb wrote: > Hi > > I' pretty sure I know the answer, but trying my luck. > > I'm in a position where the most logical/effective way of doing an update > (data fix) is this: > ALTER TABLE temp DISABLE TRIGGER trigname; > UPDATE temp ..... DO SOME STUFF.... > ALTER TABLE temp DISABLE TRIGGER trigname; > > Some notes: > It cannot be guaranteed that the above happens as a single transaction. > It is possible that this occurs at the same time as other session posting > inserts/updates to table TEMP. It can if wrapped in BEGIN/COMMIT or is there reason that is not being done? > > I'm seeing data which suggests that trigger trigname did not occur when in > fact it should have ( i.e. the above update procedure is not relevant ). > Does this make sense taking into account that multiple sessions posts to the > table at once ? Not without knowing what the trigger procedure does? > > I'm aware that session_replication_role can be used as alternative to > disable triggers, and have been using it in other scenarios. But in this > case i'd like to choose which trigger to disable (I want other triggers on > table temp to still occur). > > Is there any other alternatives to this ? > > Will appreciate any input > > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql