aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/walsender.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 3b117d83673..9e5611574cc 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -315,7 +315,13 @@ WalSndErrorCleanup(void)
replication_active = false;
- WalSndResourceCleanup(false);
+ /*
+ * If there is a transaction in progress, it will clean up our
+ * ResourceOwner, but if a replication command set up a resource owner
+ * without a transaction, we've got to clean that up now.
+ */
+ if (!IsTransactionOrTransactionBlock())
+ WalSndResourceCleanup(false);
if (got_STOPPING || got_SIGUSR2)
proc_exit(0);