aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/startup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/startup.c')
-rw-r--r--src/bin/psql/startup.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 574f49d4c9b..7c2f555f15c 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -426,8 +426,13 @@ main(int argc, char *argv[])
if (options.single_txn)
{
- res = PSQLexec((successResult == EXIT_SUCCESS) ?
- "COMMIT" : "ROLLBACK");
+ /*
+ * Rollback the contents of the single transaction if the caller
+ * has set ON_ERROR_STOP and one of the steps has failed. This
+ * check needs to match the one done a couple of lines above.
+ */
+ res = PSQLexec((successResult != EXIT_SUCCESS && pset.on_error_stop) ?
+ "ROLLBACK" : "COMMIT");
if (res == NULL)
{
if (pset.on_error_stop)