diff options
author | Michael Paquier <michael@paquier.xyz> | 2020-02-25 07:55:22 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2020-02-25 07:55:22 +0900 |
commit | 7d672b76bf27327dc3527dabcd8be4e2dedf430f (patch) | |
tree | 931a267e6246d900813fedfb99360c765764a00b | |
parent | 3d475515a15f70a4a3f36fbbba93db6877ff8346 (diff) | |
download | postgresql-7d672b76bf27327dc3527dabcd8be4e2dedf430f.tar.gz postgresql-7d672b76bf27327dc3527dabcd8be4e2dedf430f.zip |
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/E0D4CC67-A1CF-4DF4-991D-B3AC2EB5FAE9@yesql.se
-rw-r--r-- | src/backend/access/heap/heapam.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index db6fad76bc4..5a32e62ed0e 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -2191,6 +2191,14 @@ 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); + + /* + * Note that heap_multi_insert is not used for catalog tuples yet, + * but this will cover the gap once that is the case. + */ + if (needwal && need_cids) + log_heap_new_cid(relation, heaptuples[ndone]); + for (nthispage = 1; ndone + nthispage < ntuples; nthispage++) { HeapTuple heaptup = heaptuples[ndone + nthispage]; |