aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2023-11-15 10:34:35 +0100
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2023-11-15 11:03:49 +0100
commitc21e6e2fd48cdcfe7d01eed243d576c722ef8de5 (patch)
tree11648ce09c1c68cf3e2bcdf444f1408c64f44188 /src
parent325f54033e59499cfc087932f68eec5356061640 (diff)
downloadpostgresql-c21e6e2fd48cdcfe7d01eed243d576c722ef8de5.tar.gz
postgresql-c21e6e2fd48cdcfe7d01eed243d576c722ef8de5.zip
Clear CurrentResourceOwner earlier in CommitTransaction.
Alexander reported a crash with repeated create + drop database, after the ResourceOwner rewrite (commit b8bff07daa). That was fixed by the previous commit, but it nevertheless seems like a good idea clear CurrentResourceOwner earlier, because you're not supposed to use it for anything after we start releasing it. Reviewed-by: Alexander Lakhin Discussion: https://www.postgresql.org/message-id/11b70743-c5f3-3910-8e5b-dd6c115ff829%40gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xact.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 74ce5f9491c..8fad8ffa1eb 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -2309,6 +2309,7 @@ CommitTransaction(void)
CallXactCallbacks(is_parallel_worker ? XACT_EVENT_PARALLEL_COMMIT
: XACT_EVENT_COMMIT);
+ CurrentResourceOwner = NULL;
ResourceOwnerRelease(TopTransactionResourceOwner,
RESOURCE_RELEASE_BEFORE_LOCKS,
true, true);
@@ -2374,7 +2375,6 @@ CommitTransaction(void)
AtEOXact_LogicalRepWorkers(true);
pgstat_report_xact_timestamp(0);
- CurrentResourceOwner = NULL;
ResourceOwnerDelete(TopTransactionResourceOwner);
s->curTransactionOwner = NULL;
CurTransactionResourceOwner = NULL;