diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index b0d5440..dc4912f 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -1160,6 +1160,13 @@ RecordTransactionCommit(void)
 		if (nrels != 0)
 			elog(ERROR, "cannot commit a transaction that deleted files but has no xid");
 
+		/*
+		 * If relcache is invalidated then we must issue a commit record so that
+		 * the cache invalidation is replayed on standby node.
+		 */
+		if (nmsgs != 0 || RelcacheInitFileInval)
+			elog(ERROR, "cannot commit a transaction that invalidates cache but has no xid");
+
 		/* Can't have child XIDs either; AssignTransactionId enforces this */
 		Assert(nchildren == 0);
 
