diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c index cc03f0706e9..5d0c5088201 100644 --- a/src/backend/replication/logical/decode.c +++ b/src/backend/replication/logical/decode.c @@ -429,6 +429,15 @@ heap2_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) DecodeMultiInsert(ctx, buf); break; case XLOG_HEAP2_NEW_CID: + /* + * we only log new_cid's if a catalog tuple was modified, so mark the + * transaction as containing catalog modifications. + * + * Note: we do this even in fast-forward mode, as we need to maintain + * the snapshot correctly. + */ + ReorderBufferXidSetCatalogChanges(ctx->reorder, xid, buf->origptr); + if (!ctx->fast_forward) { xl_heap_new_cid *xlrec; diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 6e18baa33cb..9f78a881444 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -691,12 +691,6 @@ SnapBuildProcessNewCid(SnapBuild *builder, TransactionId xid, { CommandId cid; - /* - * we only log new_cid's if a catalog tuple was modified, so mark the - * transaction as containing catalog modifications - */ - ReorderBufferXidSetCatalogChanges(builder->reorder, xid, lsn); - ReorderBufferAddNewTupleCids(builder->reorder, xlrec->top_xid, lsn, xlrec->target_locator, xlrec->target_tid, xlrec->cmin, xlrec->cmax,