postgresql/src/bin
Michael Paquier b364cfdfaf Fix psql's single transaction mode on client-side errors with -c/-f switches
psql --single-transaction is able to handle multiple -c and -f switches
in a single transaction since d5563d7d, but this had the surprising
behavior of forcing a transaction COMMIT even if psql failed with an
error in the client (for example incorrect path given to \copy), which
would generate an error, but still commit any changes that were already
applied in the backend.  This commit makes the behavior more consistent,
by enforcing a transaction ROLLBACK if any commands fail, both
client-side and backend-side, so as no changes are applied if one error
happens in any of them.

Some tests are added on HEAD to provide some coverage about all that.
Backend-side errors are unreliable as IPC::Run can complain on SIGPIPE
if psql quits before reading a query result, but that should work
properly in the case where any errors come from psql itself, which is
what the original report is about.

Reported-by: Christoph Berg
Author: Kyotaro Horiguchi, Michael Paquier
Discussion: https://postgr.es/m/17504-76b68018e130415e@postgresql.org
Backpatch-through: 10
2022-06-06 11:07:27 +09:00
..
initdb Translation updates 2022-05-09 12:27:22 +02:00
pg_archivecleanup Translation updates 2022-05-09 12:27:22 +02:00
pg_basebackup Translation updates 2022-05-09 12:27:22 +02:00
pg_checksums Translation updates 2022-05-09 12:27:22 +02:00
pg_config Translation updates 2022-05-09 12:27:22 +02:00
pg_controldata Translation updates 2022-05-09 12:27:22 +02:00
pg_ctl Translation updates 2022-05-09 12:27:22 +02:00
pg_dump Translation updates 2022-05-09 12:27:22 +02:00
pg_resetwal Translation updates 2022-05-09 12:27:22 +02:00
pg_rewind Translation updates 2022-05-09 12:27:22 +02:00
pg_test_fsync Translation updates 2022-05-09 12:27:22 +02:00
pg_test_timing Translation updates 2022-05-09 12:27:22 +02:00
pg_upgrade Translation updates 2022-05-09 12:27:22 +02:00
pg_verifybackup Translation updates 2022-05-09 12:27:22 +02:00
pg_waldump Translation updates 2022-05-09 12:27:22 +02:00
pgbench Remove PostgreSQL::Test::Utils::perl2host completely 2022-02-20 10:35:49 -05:00
pgevent Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
psql Fix psql's single transaction mode on client-side errors with -c/-f switches 2022-06-06 11:07:27 +09:00
scripts Translation updates 2022-05-09 12:27:22 +02:00
Makefile Rename pg_validatebackup to pg_verifybackup. 2020-04-12 11:26:05 -04:00