Revert "Fix psql's single transaction mode on client-side errors with -c/-f switches".
authorTom Lane <[email protected]>
Fri, 10 Jun 2022 20:34:25 +0000 (16:34 -0400)
committerTom Lane <[email protected]>
Fri, 10 Jun 2022 20:34:25 +0000 (16:34 -0400)
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
src/bin/psql/startup.c

index 7b52ac1900216fea6033394649df35ab8446c28c..844d7e276668e481e124c6db9c9526deaacaf14d 100644 (file)
@@ -580,10 +580,8 @@ EOF
         <application>psql</application> to issue a <command>BEGIN</> command
         before the first such option and a <command>COMMIT</> command after
         the last one, thereby wrapping all the commands into a single
-        transaction. If any of the commands fails, a
-        <command>ROLLBACK</command> 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.
        </para>
 
        <para>
index 36e9432fc677b0136a37ec83bf61d94af83f7370..260b4ea55cde05f1df90c6476db22986b1c59b07 100644 (file)
@@ -371,9 +371,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)
                {