diff --git a/src/backend/replication/logical/relation.c b/src/backend/replication/logical/relation.c index bc87105acc3..aa41b791129 100644 --- a/src/backend/replication/logical/relation.c +++ b/src/backend/replication/logical/relation.c @@ -260,6 +260,13 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode) MemoryContext oldctx; int i; + /* Release the no-longer-useful attrmap, if any. */ + if (entry->attrmap) + { + pfree(entry->attrmap); + entry->attrmap = NULL; + } + /* Try to find and lock the relation by name. */ relid = RangeVarGetRelid(makeRangeVar(remoterel->nspname, remoterel->relname, -1),