pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN @ 2021-02-19 13:03 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Fujii Masao @ 2021-02-19 13:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN. When ON_ERROR_ROLLBACK is enabled, psql releases a temporary savepoint if it's idle in a valid transaction block after executing a query. But psql doesn't do that after RELEASE or ROLLBACK is executed because a temporary savepoint has already been destroyed in that case. This commit changes psql's ON_ERROR_ROLLBACK so that it doesn't release a temporary savepoint also when COMMIT AND CHAIN is executed. A temporary savepoint doesn't need to be released in that case because COMMIT AND CHAIN also destroys any savepoints defined within the transaction to commit. Otherwise psql tries to release the savepoint that COMMIT AND CHAIN has already destroyed and cause an error "ERROR: savepoint "pg_psql_temporary_savepoint" does not exist". Back-patch to v12 where transaction chaining was added. Reported-by: Arthur Nascimento Author: Arthur Nascimento Reviewed-by: Fujii Masao, Vik Fearing Discussion: https://postgr.es/m/16867-3475744069228158@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/67b3ee292935352b4b12b7a1bce17c64f85ce32e Modified Files -------------- src/bin/psql/common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN @ 2021-02-19 13:03 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Fujii Masao @ 2021-02-19 13:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN. When ON_ERROR_ROLLBACK is enabled, psql releases a temporary savepoint if it's idle in a valid transaction block after executing a query. But psql doesn't do that after RELEASE or ROLLBACK is executed because a temporary savepoint has already been destroyed in that case. This commit changes psql's ON_ERROR_ROLLBACK so that it doesn't release a temporary savepoint also when COMMIT AND CHAIN is executed. A temporary savepoint doesn't need to be released in that case because COMMIT AND CHAIN also destroys any savepoints defined within the transaction to commit. Otherwise psql tries to release the savepoint that COMMIT AND CHAIN has already destroyed and cause an error "ERROR: savepoint "pg_psql_temporary_savepoint" does not exist". Back-patch to v12 where transaction chaining was added. Reported-by: Arthur Nascimento Author: Arthur Nascimento Reviewed-by: Fujii Masao, Vik Fearing Discussion: https://postgr.es/m/16867-3475744069228158@postgresql.org Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/be7485a1e31122f92b6dd9ad02427c1daa870b63 Modified Files -------------- src/bin/psql/common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN @ 2021-02-19 13:04 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Fujii Masao @ 2021-02-19 13:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN. When ON_ERROR_ROLLBACK is enabled, psql releases a temporary savepoint if it's idle in a valid transaction block after executing a query. But psql doesn't do that after RELEASE or ROLLBACK is executed because a temporary savepoint has already been destroyed in that case. This commit changes psql's ON_ERROR_ROLLBACK so that it doesn't release a temporary savepoint also when COMMIT AND CHAIN is executed. A temporary savepoint doesn't need to be released in that case because COMMIT AND CHAIN also destroys any savepoints defined within the transaction to commit. Otherwise psql tries to release the savepoint that COMMIT AND CHAIN has already destroyed and cause an error "ERROR: savepoint "pg_psql_temporary_savepoint" does not exist". Back-patch to v12 where transaction chaining was added. Reported-by: Arthur Nascimento Author: Arthur Nascimento Reviewed-by: Fujii Masao, Vik Fearing Discussion: https://postgr.es/m/16867-3475744069228158@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/fe06819f105ccea52c12d418c8dbaaaa54377e96 Modified Files -------------- src/bin/psql/common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-02-19 13:04 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-02-19 13:03 pgsql: Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN Fujii Masao <fujii@postgresql.org> 2021-02-19 13:03 pgsql: Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN Fujii Masao <fujii@postgresql.org> 2021-02-19 13:04 pgsql: Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN Fujii Masao <fujii@postgresql.org>
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