Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nzhFC-0005EW-RR for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Jun 2022 16:12:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nzhFB-00050N-LE for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Jun 2022 16:12:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nzhFB-00050E-CB for pgsql-bugs@lists.postgresql.org; Fri, 10 Jun 2022 16:12:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nzhF9-0003T5-1b for pgsql-bugs@lists.postgresql.org; Fri, 10 Jun 2022 16:12:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 25AGCBNv2656556; Fri, 10 Jun 2022 12:12:11 -0400 From: Tom Lane To: Michael Paquier cc: Robert Haas , Kyotaro Horiguchi , christoph.berg@credativ.de, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17504: psql --single-transaction -vON_ERROR_STOP=1 still commits after client-side error In-reply-to: <2649417.1654875709@sss.pgh.pa.us> References: <20220531.113927.640026319524742851.horikyota.ntt@gmail.com> <20220603.175603.682874096867945240.horikyota.ntt@gmail.com> <2649417.1654875709@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 10 Jun 2022 11:41:49 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2656554.1654877531.1@sss.pgh.pa.us> Date: Fri, 10 Jun 2022 12:12:11 -0400 Message-ID: <2656555.1654877531@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > ISTM that an appropriate fix would be to remember if any command > failed, not just the last one. Alternatively, one could argue that once we've decided to issue ROLLBACK, there's not really any reason to continue performing additional -c/-f actions, so that a sufficient fix would be to get rid of the loop's ON_ERROR_STOP conditionality: - if (successResult != EXIT_SUCCESS && pset.on_error_stop) + if (successResult != EXIT_SUCCESS) break; But I'm not sure that that argument is bulletproof. If we are considering a client-side failure then the server may still think the transaction is fine, in which case we should continue to perform actions that could have client-side side effects; or at least, not doing so is a potentially significant behavioral change. In any case, I now agree with Robert's upthread objection that this should not have been back-patched. It's a nontrivial behavioral change and it's not clear that it's 100% without downsides. I particularly do not want to ship 14.4 with this, because we really need a clean release with no new regressions. regards, tom lane