postgres.git / summary / log / commit / refs
commit aaa88d3828c371140e2bf5686328d5fc50b8ce10
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Fri Jun 10 20:34:25 2022 +0000
First released in: 10.22, 11.17, 12.12, 13.8, 14.4
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 7dd177a70cd..fa58f71e15f 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -582,10 +582,8 @@ EOF
<application>psql</application> to issue a <command>BEGIN</command> command
before the first such option and a <command>COMMIT</command> 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>
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 08dc7786a4e..d688a5d7d6c 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -386,9 +386,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)
{
[parent: 199aac8b2f74]