Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3Dwo-0000bx-0I for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Aug 2019 06:30:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i3Dwm-0003kg-Nc for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Aug 2019 06:30:16 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3Dwm-0003kW-FW; Thu, 29 Aug 2019 06:30:16 +0000 Received: from courriel.mines-paristech.fr ([77.158.173.149] helo=antispam-1.ensmp.fr) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3Dwf-0001jO-My; Thu, 29 Aug 2019 06:30:15 +0000 Received: from smtp-4.mines-paristech.fr (smtp-4.ensmp.fr [77.158.173.143]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by antispam-1.ensmp.fr (antispam.mines-paristech.fr) with ESMTPS id BE85955E0F; Thu, 29 Aug 2019 08:30:08 +0200 (CEST) Received: from lancre (184.86.8.93.rev.sfr.net [93.8.86.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-4.mines-paristech.fr (Postfix) with ESMTPSA id 7834C2C01C8; Thu, 29 Aug 2019 08:30:08 +0200 (CEST) Date: Thu, 29 Aug 2019 08:30:07 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@lancre To: fn ln cc: PostgreSQL Bugs , PostgreSQL Developers Subject: Re: BUG #15977: Inconsistent behavior in chained transactions In-Reply-To: Message-ID: References: <15977-f4eb49ebdcacc65b@postgresql.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrudeiuddguddtjecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffujgfkfhgfgggtsehttdertddtredvnecuhfhrohhmpefhrggsihgvnhcuvefqgffnjffquceotghovghlhhhosegtrhhirdgvnhhsmhhprdhfrheqnecukfhppeelfedrkedrkeeirddukeegnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhht X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, > COMMIT AND CHAIN in implicit block leaves blockState as TBLOCK_STARTED, > which doesn't trigger the chaining. but ROLLBACK AND CHAIN sets the > blockState into TBLOCK_ABORT_PENDING, so the chaining is triggered. > > I think disabling s->chain beforehand should do the desired behavior. Patch applies with "patch", although "git apply" complained because of CRLF line terminations forced by the octet-stream mime type. Patch compiles cleanly. Make check ok. Patch works for me, and solution seems appropriate. It should be committed for pg 12.0. There could be a test added in "regress/sql/transactions.sql", I'd suggest something like: -- implicit transaction and not chained. COMMIT AND CHAIN; COMMIT; ROLLBACK AND CHAIN; ROLLBACK; which should show the appropriate "no transaction in progress" warnings. Doc could be made a little clearer about what to expect when there is no explicit transaction in progress. -- Fabien.