pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix psql's single transaction mode on client-side errors with -c 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix psql's single transaction mode on client-side errors with -c @ 2022-06-06 02:08 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2022-06-06 02:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/157f8739ad18278ca946758b2f274a8109a0aa08 Modified Files -------------- doc/src/sgml/ref/psql-ref.sgml | 6 ++-- src/bin/psql/startup.c | 4 ++- src/bin/psql/t/001_basic.pl | 64 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix psql's single transaction mode on client-side errors with -c @ 2022-06-06 02:08 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2022-06-06 02:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a04ccf6dfb4a15b9c279154b3366f8051de8b5d1 Modified Files -------------- doc/src/sgml/ref/psql-ref.sgml | 6 ++++-- src/bin/psql/startup.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix psql's single transaction mode on client-side errors with -c @ 2022-06-06 02:08 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2022-06-06 02:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b364cfdfaf6b24e18c8f6017111306259f87c0f4 Modified Files -------------- doc/src/sgml/ref/psql-ref.sgml | 6 ++++-- src/bin/psql/startup.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix psql's single transaction mode on client-side errors with -c @ 2022-06-06 02:08 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2022-06-06 02:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0a1e4f0ca788b6d6db301e5dda44429361eabdc7 Modified Files -------------- doc/src/sgml/ref/psql-ref.sgml | 6 ++++-- src/bin/psql/startup.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix psql's single transaction mode on client-side errors with -c @ 2022-06-06 02:08 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2022-06-06 02:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b0bd9327dd74b48dbd2b18b0de22388490ddca71 Modified Files -------------- doc/src/sgml/ref/psql-ref.sgml | 6 ++++-- src/bin/psql/startup.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix psql's single transaction mode on client-side errors with -c @ 2022-06-06 02:08 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 6+ messages in thread From: Michael Paquier @ 2022-06-06 02:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c3df4d53ca4a7981a416cc404147e2151aa257c5 Modified Files -------------- doc/src/sgml/ref/psql-ref.sgml | 6 ++++-- src/bin/psql/startup.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2022-06-06 02:08 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-06-06 02:08 pgsql: Fix psql's single transaction mode on client-side errors with -c Michael Paquier <michael@paquier.xyz> 2022-06-06 02:08 pgsql: Fix psql's single transaction mode on client-side errors with -c Michael Paquier <michael@paquier.xyz> 2022-06-06 02:08 pgsql: Fix psql's single transaction mode on client-side errors with -c Michael Paquier <michael@paquier.xyz> 2022-06-06 02:08 pgsql: Fix psql's single transaction mode on client-side errors with -c Michael Paquier <michael@paquier.xyz> 2022-06-06 02:08 pgsql: Fix psql's single transaction mode on client-side errors with -c Michael Paquier <michael@paquier.xyz> 2022-06-06 02:08 pgsql: Fix psql's single transaction mode on client-side errors with -c Michael Paquier <michael@paquier.xyz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox