From ca15c3802be2abac58d288a4d1c91943a867a46d Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Wed, 18 Mar 2026 15:26:00 +0900 Subject: [PATCH v2] Release postmaster working memory context in slotsync worker Child processes do not need the postmaster's working memory context and normally release it at the start of their main entry point. However, the slotsync worker forgot to do so. This commit makes the slotsync worker release the postmaster's working memory context at startup, ensuring it does not have access to postmaster-private data. --- src/backend/replication/logical/slotsync.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c index e75db69e3f6..d103223c21f 100644 --- a/src/backend/replication/logical/slotsync.c +++ b/src/backend/replication/logical/slotsync.c @@ -1485,6 +1485,13 @@ ReplSlotSyncWorkerMain(const void *startup_data, size_t startup_data_len) Assert(startup_data_len == 0); + /* Release postmaster's working memory context */ + if (PostmasterContext) + { + MemoryContextDelete(PostmasterContext); + PostmasterContext = NULL; + } + init_ps_display(NULL); Assert(GetProcessingMode() == InitProcessing); -- 2.51.2