Skip to content

Commit 044996b

Browse files
committed
Do not close portals in autonomous transaction
1 parent 9ac524a commit 044996b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/backend/access/transam/xact.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,7 +2040,7 @@ CommitTransaction(void)
20402040
* If there weren't any, we are done ... otherwise loop back to check
20412041
* if they queued deferred triggers. Lather, rinse, repeat.
20422042
*/
2043-
if (!PreCommit_Portals(false))
2043+
if (getNestLevelATX() != 0 || !PreCommit_Portals(false))
20442044
break;
20452045
}
20462046

@@ -2280,7 +2280,7 @@ PrepareTransaction(void)
22802280
* If there weren't any, we are done ... otherwise loop back to check
22812281
* if they queued deferred triggers. Lather, rinse, repeat.
22822282
*/
2283-
if (!PreCommit_Portals(true))
2283+
if (getNestLevelATX() != 0 || !PreCommit_Portals(false))
22842284
break;
22852285
}
22862286

src/pl/plpgsql/src/pl_exec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,15 +1230,15 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
12301230
edata = CopyErrorData();
12311231
FlushErrorState();
12321232

1233+
estate->eval_econtext = old_eval_econtext;
1234+
12331235
plpgsql_destroy_econtext(estate);
12341236

12351237
old_shared_estate = shared_simple_eval_estate;
12361238
shared_simple_eval_estate = NULL;
12371239
AbortCurrentTransaction();
12381240
shared_simple_eval_estate = old_shared_estate;
12391241

1240-
estate->eval_econtext = old_eval_econtext;
1241-
12421242
if (block->exceptions)
12431243
{
12441244
/* Look for a matching exception handler */

0 commit comments

Comments
 (0)