Skip to content

Commit 7d672b7

Browse files
committed
Issue properly WAL record for CID of first catalog tuple in multi-insert
Multi-insert for heap is not yet used actively for catalogs, but the code to support this case is in place for logical decoding. The existing code forgot to issue a XLOG_HEAP2_NEW_CID record for the first tuple inserted, leading to failures when attempting to use multiple inserts for catalogs at decoding time. This commit fixes the problem by WAL-logging the needed CID. This is not an active bug, so no back-patch is done. Author: Daniel Gustafsson Discussion: https://postgr.es/m/[email protected]
1 parent 3d47551 commit 7d672b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/backend/access/heap/heapam.c

+8
Original file line numberDiff line numberDiff line change
@@ -2191,6 +2191,14 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
21912191
* Put that on the page, and then as many other tuples as fit.
21922192
*/
21932193
RelationPutHeapTuple(relation, buffer, heaptuples[ndone], false);
2194+
2195+
/*
2196+
* Note that heap_multi_insert is not used for catalog tuples yet,
2197+
* but this will cover the gap once that is the case.
2198+
*/
2199+
if (needwal && need_cids)
2200+
log_heap_new_cid(relation, heaptuples[ndone]);
2201+
21942202
for (nthispage = 1; ndone + nthispage < ntuples; nthispage++)
21952203
{
21962204
HeapTuple heaptup = heaptuples[ndone + nthispage];

0 commit comments

Comments
 (0)