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

Commit73bf9b7

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 parent785b8d6 commit73bf9b7

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
@@ -3748,7 +3748,24 @@ AbortOutOfAnyTransaction(void)
37483748
switch (s->blockState)
37493749
{
37503750
caseTBLOCK_DEFAULT:
3751-
/* Not in a transaction, do nothing */
3751+
if (s->state==TRANS_DEFAULT)
3752+
{
3753+
/* Not in a transaction, do nothing */
3754+
}
3755+
else
3756+
{
3757+
/*
3758+
* We can get here after an error during transaction start
3759+
* (state will be TRANS_START). Need to clean up the
3760+
* incompletely started transaction. First, adjust the
3761+
* low-level state to suppress warning message from
3762+
* AbortTransaction.
3763+
*/
3764+
if (s->state==TRANS_START)
3765+
s->state=TRANS_INPROGRESS;
3766+
AbortTransaction();
3767+
CleanupTransaction();
3768+
}
37523769
break;
37533770
caseTBLOCK_STARTED:
37543771
caseTBLOCK_BEGIN:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp