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

Commit2755abf

Browse files
committed
Teach AbortOutOfAnyTransaction to clean up partially-started transactions.
AbortOutOfAnyTransaction failed to do anything if the state it saw onentry corresponded to failing partway through StartTransaction. I fixedAbortCurrentTransaction to cope with that case way back in commit60b2444, but evidently overlooked thatAbortOutOfAnyTransaction should do likewise.Back-patch to all supported branches. It's not clear that this omissionhas any more-than-cosmetic consequences, but it's also not clear that itdoesn't, so back-patching seems the least risky choice.
1 parentc89bdf7 commit2755abf

File tree

1 file changed

+18
-1
lines changed
  • src/backend/access/transam

1 file changed

+18
-1
lines changed

‎src/backend/access/transam/xact.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3861,7 +3861,24 @@ AbortOutOfAnyTransaction(void)
38613861
switch (s->blockState)
38623862
{
38633863
caseTBLOCK_DEFAULT:
3864-
/* Not in a transaction, do nothing */
3864+
if (s->state==TRANS_DEFAULT)
3865+
{
3866+
/* Not in a transaction, do nothing */
3867+
}
3868+
else
3869+
{
3870+
/*
3871+
* We can get here after an error during transaction start
3872+
* (state will be TRANS_START). Need to clean up the
3873+
* incompletely started transaction. First, adjust the
3874+
* low-level state to suppress warning message from
3875+
* AbortTransaction.
3876+
*/
3877+
if (s->state==TRANS_START)
3878+
s->state=TRANS_INPROGRESS;
3879+
AbortTransaction();
3880+
CleanupTransaction();
3881+
}
38653882
break;
38663883
caseTBLOCK_STARTED:
38673884
caseTBLOCK_BEGIN:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp