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 1i6UcX-0003iq-CG for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Sep 2019 06:54:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i6UcV-0007SJ-9a for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Sep 2019 06:54:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i6UcU-0007Kb-TY for pgsql-hackers@lists.postgresql.org; Sat, 07 Sep 2019 06:54:51 +0000 Received: from courriel.mines-paristech.fr ([77.158.173.149] helo=antispam-1.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i6UcR-0005hP-Al for pgsql-hackers@lists.postgresql.org; Sat, 07 Sep 2019 06:54:49 +0000 Received: from smtp-5.mines-paristech.fr (smtp.mines-paristech.fr [77.158.173.146]) (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 198B955F1E; Sat, 7 Sep 2019 08:54:44 +0200 (CEST) Received: from lancre (251.237.219.88.rev.sfr.net [88.219.237.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-5.mines-paristech.fr (Postfix) with ESMTPSA id 71C72201C6; Sat, 7 Sep 2019 08:54:43 +0200 (CEST) Date: Sat, 7 Sep 2019 08:54:42 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@lancre To: Michael Paquier , Andres Freund cc: Peter Eisentraut , fn ln , PostgreSQL Developers Subject: Re: BUG #15977: Inconsistent behavior in chained transactions In-Reply-To: <20190906075415.GA31979@paquier.xyz> Message-ID: References: <8655dc29-8d50-162d-deaf-fa0329dfed51@2ndquadrant.com> <20190904075305.2gkf5z4r6xwgxcwf@alap3.anarazel.de> <20190905211135.q63scps3pvrc3i43@alap3.anarazel.de> <20190906075415.GA31979@paquier.xyz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrudektddgudduvdcutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffujgfkfhgfgggtsehttdertddtredvnecuhfhrohhmpefhrggsihgvnhcuvefqgffnjffquceotghovghlhhhosegtrhhirdgvnhhsmhhprdhfrheqnecukfhppeekkedrvdduledrvdefjedrvdehudenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, >> I do think the fact that COMMIT in multi-statement implicit transaction >> has some usecase, is an argument for just implementing it properly... > > Like Peter, I would also keep an ERROR for now, as we could always > relax that later on. I can agree with both warning and error, but for me the choice should be consistent with the current behavior of COMMIT and ROLLBACK in the same context. pg> CREATE OR REPLACE PROCEDURE warn(msg TEXT) LANGUAGE plpgsql AS $$ BEGIN RAISE WARNING 'warning: %', msg ; END ; $$; Then an out-of-transaction multi-statement commit: pg> CALL warn('1') \; COMMIT \; CALL warn('2') ; WARNING: warning: 1 WARNING: there is no transaction in progress WARNING: warning: 2 CALL But v4 creates an non uniform behavior that I find surprising and unwelcome: pg> CALL warn('1') \; COMMIT AND CHAIN \; CALL warn('2') ; WARNING: warning: 1 ERROR: COMMIT AND CHAIN can only be used in transaction blocks Why "commit" & "commit and chain" should behave differently in the same context? For me they can error or warn, but consistency implies that they should do the exact same thing.