diff --git a/src/backend/replication/logical/relation.c b/src/backend/replication/logical/relation.c index 16f4c56bfd..03ddaaaae9 100644 --- a/src/backend/replication/logical/relation.c +++ b/src/backend/replication/logical/relation.c @@ -259,6 +259,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),