From 377692b2eba99408a2adf6aeb7b7fa42affe73ad Mon Sep 17 00:00:00 2001
From: ChangAo Chen <cca5507@qq.com>
Date: Sat, 22 Nov 2025 16:51:13 +0800
Subject: [PATCH v1] Handle XLOG_HEAP2_NEW_CID in heap2_decode() even if
 fast-forwarding.

---
 src/backend/replication/logical/decode.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index cc03f0706e9..ffd4372917b 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -435,9 +435,11 @@ heap2_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 
 				xlrec = (xl_heap_new_cid *) XLogRecGetData(buf->record);
 				SnapBuildProcessNewCid(builder, xid, buf->origptr, xlrec);
-
-				break;
 			}
+			else
+				ReorderBufferXidSetCatalogChanges(ctx->reorder, xid,
+												  buf->origptr);
+			break;
 		case XLOG_HEAP2_REWRITE:
 
 			/*
-- 
2.51.2

