From 3f7f06738529f4a71cf33c79654954e6178972a1 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 10 Jun 2022 16:34:25 -0400 Subject: [PATCH] Revert "Fix psql's single transaction mode on client-side errors with -c/-f switches". This reverts commits a04ccf6df et al. in the back branches only. There was some disagreement already over whether to back-patch 157f8739a, on the grounds that it is the sort of behavioral change that we don't like to back-patch. Furthermore, it now looks like the logic needs some more work, which we don't have time for before the upcoming 14.4 release. Revert for now, and perhaps reconsider later. Discussion: https://postgr.es/m/17504-76b68018e130415e@postgresql.org --- doc/src/sgml/ref/psql-ref.sgml | 6 ++---- src/bin/psql/startup.c | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index fc0e3e4d8a..1802330b70 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -591,10 +591,8 @@ EOF psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single - transaction. If any of the commands fails, a - ROLLBACK command is sent instead. This ensures that - either all the commands complete successfully, or no changes are - applied. + transaction. This ensures that either all the commands complete + successfully, or no changes are applied. diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index ce180e1cd7..392b96eb86 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -412,9 +412,7 @@ main(int argc, char *argv[]) if (options.single_txn) { - res = PSQLexec((successResult == EXIT_SUCCESS) ? - "COMMIT" : "ROLLBACK"); - if (res == NULL) + if ((res = PSQLexec("COMMIT")) == NULL) { if (pset.on_error_stop) {