Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9a0z-0005bT-P4 for pgsql-sql@arkaria.postgresql.org; Mon, 29 Jun 2015 14:26:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z9a0z-0002hN-5r for pgsql-sql@arkaria.postgresql.org; Mon, 29 Jun 2015 14:26:29 +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 1Z9a0x-0002hE-4F for pgsql-sql@postgresql.org; Mon, 29 Jun 2015 14:26:27 +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 1Z9a0p-0002TE-CY for pgsql-sql@postgresql.org; Mon, 29 Jun 2015 14:26:26 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 076EE20980 for ; Mon, 29 Jun 2015 10:26:17 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Mon, 29 Jun 2015 10:26:17 -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=TdVSNh0O2dgBV3mV6ge939CMQug=; b=mUc4o0 74p5NF81WyBoBuSKZbdUrlfsywlVHcKCuLvxCr3B6CLb0Pjz/ANjQh/h2acFLFUd IXZ2WQCTLFHoz08zj2qYgBL8UGq78Aohdsi050XChqs1p8nlswfJhwXDxVcGsAVo Gd/EuU/Q5n2TiRECUHVPMLGeELmO4PUGfc/w8= 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=TdVSNh0O2dgBV3m V6ge939CMQug=; b=EndHs6GEFCFLJ4T+7zm9eK4yRk/ghEZVZJtEum0qEh+jG2w VxNkttoUUUd4PJTGJG3CMZzpYcYf3SMnekF1FCxe4/+2lbJYjwYus+7WOFK7ixxs jqHLhyieTpw2VwFArzUubxbSy52knctJcwEk1Y5qBnpdlzCoCthAOKjeM25I= X-Sasl-enc: heyj3zajzzWOSrQVGAYv6sllmGWcsy/dUzIO8VSOlkAm 1435587976 Received: from [192.168.1.2] (unknown [174.21.228.230]) by mail.messagingengine.com (Postfix) with ESMTPA id 7CC1C6800D3; Mon, 29 Jun 2015 10:26:16 -0400 (EDT) Message-ID: <55915587.2020606@aklaver.com> Date: Mon, 29 Jun 2015 07:26:15 -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> <559142D5.2080608@aklaver.com> <1435587185136-5855697.post@n5.nabble.com> In-Reply-To: <1435587185136-5855697.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 07:13 AM, gmb wrote: > Adrian Klaver-4 wrote >>> >>> 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? > > Sorry , what I meant to say was that as this stage this is not implemented > in a single transaction (with BEGIN/COMMIT). > > > Adrian Klaver-4 wrote >>> 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? > > The trigger being disabled is used to post summarized numeric values to a > summary table. > Actually what I'm trying to do here is to reset the values in the detail > table to zero without updating the summary tables. Afterwards I'm updating > from a zero value which means that the difference will be posted to the > summary table. This kind of data fix is required where data on the summary > tables was not posted as excepted for whatever reason. > > > I guess my question is: > If I encapsulate the "disable trigger/update/enable trigger" in BEGIN/COMMIT > to handle as single transaction, are there guarantees that the disabling of > the trigger will not have an effect on other sessions ? That I do not know. A thought did come to mind though. That is to add a reset boolean column(default ='f') to your detail table and make the trigger procedure aware of it. Then when you are resetting the values to zero have reset = 't' and have the trigger procedure ignore those rows. Then do the 'normal' update to update the summary table. > > > > -- > View this message in context: http://postgresql.nabble.com/Disable-Trigger-for-session-only-tp5855658p5855697.html > Sent from the PostgreSQL - sql mailing list archive at Nabble.com. > > -- 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