summaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xact.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/transam/xact.c')
-rw-r--r--src/backend/access/transam/xact.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 5d89f828187..74ce5f9491c 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -5172,9 +5172,23 @@ AbortSubTransaction(void)
ResourceOwnerRelease(s->curTransactionOwner,
RESOURCE_RELEASE_BEFORE_LOCKS,
false, false);
+
AtEOSubXact_RelationCache(false, s->subTransactionId,
s->parent->subTransactionId);
+
+
+ /*
+ * AtEOSubXact_Inval sometimes needs to temporarily bump the refcount
+ * on the relcache entries that it processes. We cannot use the
+ * subtransaction's resource owner anymore, because we've already
+ * started releasing it. But we can use the parent resource owner.
+ */
+ CurrentResourceOwner = s->parent->curTransactionOwner;
+
AtEOSubXact_Inval(false);
+
+ CurrentResourceOwner = s->curTransactionOwner;
+
ResourceOwnerRelease(s->curTransactionOwner,
RESOURCE_RELEASE_LOCKS,
false, false);