From 26832e2e81ba68da5f67eab79f301b71d1f3ed57 Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <daniel@yesql.se>
Date: Fri, 21 Feb 2020 22:43:24 +0100
Subject: [PATCH 2/2] Fix bug in recording CID for first tuple in a
 heap_multi_insert

---
 src/backend/access/heap/heapam.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index db6fad76bc..67cbceb22f 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -2191,6 +2191,8 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
 		 * Put that on the page, and then as many other tuples as fit.
 		 */
 		RelationPutHeapTuple(relation, buffer, heaptuples[ndone], false);
+		if (needwal && need_cids)
+			log_heap_new_cid(relation, heaptuples[ndone]);
 		for (nthispage = 1; ndone + nthispage < ntuples; nthispage++)
 		{
 			HeapTuple	heaptup = heaptuples[ndone + nthispage];
-- 
2.21.1 (Apple Git-122.3)

