Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe7485a

Browse files
committed
Fix psql's ON_ERROR_ROLLBACK so that it handles COMMIT AND CHAIN.
When ON_ERROR_ROLLBACK is enabled, psql releases a temporary savepointif it's idle in a valid transaction block after executing a query. But psqldoesn't do that after RELEASE or ROLLBACK is executed because a temporarysavepoint has already been destroyed in that case.This commit changes psql's ON_ERROR_ROLLBACK so that it doesn't releasea temporary savepoint also when COMMIT AND CHAIN is executed. A temporarysavepoint doesn't need to be released in that case becauseCOMMIT AND CHAIN also destroys any savepoints defined within the transactionto commit. Otherwise psql tries to release the savepoint thatCOMMIT 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 NascimentoAuthor: Arthur NascimentoReviewed-by: Fujii Masao, Vik FearingDiscussion:https://postgr.es/m/16867-3475744069228158@postgresql.org
1 parent422012c commitbe7485a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

‎src/bin/psql/common.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,12 +1346,13 @@ SendQuery(const char *query)
13461346

13471347
/*
13481348
* Do nothing if they are messing with savepoints themselves:
1349-
* If the user did RELEASE or ROLLBACK, our savepoint is gone.
1350-
* If they issued a SAVEPOINT, releasing ours would remove
1351-
* theirs.
1349+
* If the user didCOMMIT AND CHAIN,RELEASE or ROLLBACK, our
1350+
*savepoint is gone.If they issued a SAVEPOINT, releasing
1351+
*ours would removetheirs.
13521352
*/
13531353
if (results&&
1354-
(strcmp(PQcmdStatus(results),"SAVEPOINT")==0||
1354+
(strcmp(PQcmdStatus(results),"COMMIT")==0||
1355+
strcmp(PQcmdStatus(results),"SAVEPOINT")==0||
13551356
strcmp(PQcmdStatus(results),"RELEASE")==0||
13561357
strcmp(PQcmdStatus(results),"ROLLBACK")==0))
13571358
svptcmd=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp