mirror of
https://github.com/postgres/postgres.git
synced 2025-10-24 01:29:19 +03:00
Fix interaction of partitioned tables with BulkInsertState.
When copying into a partitioned table, the target heap may change from one tuple to next. We must ask ReadBufferBI() to get a new buffer every time such change occurs. To do that, use new function ReleaseBulkInsertStatePin(). This fixes the bug that tuples ended up being inserted into the wrong partition, which occurred exactly because the wrong buffer was used. Amit Langote, per a suggestion from Robert Haas. Some cosmetic adjustments by me. Reports by 高增琦 (Gao Zengqi), Venkata B Nagothi, and Ragnar Ouchterlony. Discussion: http://postgr.es/m/CAFmBtr32FDOqofo8yG-4mjzL1HnYHxXK5S9OGFJ%3D%3DcJpgEW4vA%40mail.gmail.com Discussion: http://postgr.es/m/CAEyp7J9WiX0L3DoiNcRrY-9iyw%3DqP%2Bj%3DDLsAnNFF1xT2J1ggfQ%40mail.gmail.com Discussion: http://postgr.es/m/16d73804-c9cd-14c5-463e-5caad563ff77%40agama.tv Discussion: http://postgr.es/m/CA+TgmoaiZpDVUUN8LZ4jv1qFE_QyR+H9ec+79f5vNczYarg5Zg@mail.gmail.com
This commit is contained in:
@@ -147,6 +147,7 @@ extern void setLastTid(const ItemPointer tid);
|
||||
|
||||
extern BulkInsertState GetBulkInsertState(void);
|
||||
extern void FreeBulkInsertState(BulkInsertState);
|
||||
extern void ReleaseBulkInsertStatePin(BulkInsertState bistate);
|
||||
|
||||
extern Oid heap_insert(Relation relation, HeapTuple tup, CommandId cid,
|
||||
int options, BulkInsertState bistate);
|
||||
|
||||
Reference in New Issue
Block a user