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

Commitcc2469b

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 parent2791f21 commitcc2469b

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
@@ -3802,7 +3802,24 @@ AbortOutOfAnyTransaction(void)
38023802
switch (s->blockState)
38033803
{
38043804
caseTBLOCK_DEFAULT:
3805-
/* Not in a transaction, do nothing */
3805+
if (s->state==TRANS_DEFAULT)
3806+
{
3807+
/* Not in a transaction, do nothing */
3808+
}
3809+
else
3810+
{
3811+
/*
3812+
* We can get here after an error during transaction start
3813+
* (state will be TRANS_START). Need to clean up the
3814+
* incompletely started transaction. First, adjust the
3815+
* low-level state to suppress warning message from
3816+
* AbortTransaction.
3817+
*/
3818+
if (s->state==TRANS_START)
3819+
s->state=TRANS_INPROGRESS;
3820+
AbortTransaction();
3821+
CleanupTransaction();
3822+
}
38063823
break;
38073824
caseTBLOCK_STARTED:
38083825
caseTBLOCK_BEGIN:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp