From 46e819a162e39ae3f0ba008a65ec03d727e78a2e Mon Sep 17 00:00:00 2001 From: Ajin Cherian Date: Tue, 1 Dec 2026 18:10:43 +1100 Subject: [PATCH v2 2/2] Close relations opened in pgoutput helper functions pgoutput_ensure_entry_cxt() and check_and_init_gencol() get the relation with RelationIdGetRelation() but never call RelationClose(), so each call leaves a relcache reference behind. The other functions in pgoutput.c that use RelationIdGetRelation() do close the relation. pgoutput_ensure_entry_cxt() can close the relation once the memory context identifier has been set, since that copies the relation name. Add the missing RelationClose() calls. --- src/backend/replication/pgoutput/pgoutput.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 4cb36f6d075..c484c7199de 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -910,6 +910,8 @@ pgoutput_ensure_entry_cxt(PGOutputData *data, RelationSyncEntry *entry) MemoryContextCopyAndSetIdentifier(entry->entry_cxt, RelationGetRelationName(relation)); + + RelationClose(relation); } /* @@ -1087,6 +1089,7 @@ check_and_init_gencol(PGOutputData *data, List *publications, if (!gencolpresent) { entry->include_gencols_type = PUBLISH_GENCOLS_NONE; + RelationClose(relation); return; } @@ -1116,6 +1119,8 @@ check_and_init_gencol(PGOutputData *data, List *publications, get_namespace_name(RelationGetNamespace(relation)), RelationGetRelationName(relation))); } + + RelationClose(relation); } /* -- 2.47.3