@@ -512,7 +512,8 @@ typedef struct TableAmRoutine
512
512
/* see table_tuple_insert() for reference about parameters */
513
513
TupleTableSlot * (* tuple_insert ) (Relation rel , TupleTableSlot * slot ,
514
514
CommandId cid , int options ,
515
- struct BulkInsertStateData * bistate );
515
+ struct BulkInsertStateData * bistate ,
516
+ bool * insert_indexes );
516
517
517
518
/* see table_tuple_insert_speculative() for reference about parameters */
518
519
void (* tuple_insert_speculative ) (Relation rel ,
@@ -530,7 +531,8 @@ typedef struct TableAmRoutine
530
531
531
532
/* see table_multi_insert() for reference about parameters */
532
533
void (* multi_insert ) (Relation rel , TupleTableSlot * * slots , int nslots ,
533
- CommandId cid , int options , struct BulkInsertStateData * bistate );
534
+ CommandId cid , int options , struct BulkInsertStateData * bistate ,
535
+ bool * insert_indexes );
534
536
535
537
/* see table_tuple_delete() for reference about parameters */
536
538
TM_Result (* tuple_delete ) (Relation rel ,
@@ -1384,6 +1386,12 @@ table_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
1384
1386
* behavior) is also just passed through to RelationGetBufferForTuple. If
1385
1387
* `bistate` is provided, table_finish_bulk_insert() needs to be called.
1386
1388
*
1389
+ * The table AM's implementation of tuple_insert should set `*insert_indexes`
1390
+ * to true if it expects the caller to insert the relevant index tuples
1391
+ * (as heap table AM does). It should set `*insert_indexes` to false if
1392
+ * it cares about index inserts itself and doesn't want the caller to do
1393
+ * index inserts.
1394
+ *
1387
1395
* Returns the slot containing the inserted tuple, which may differ from the
1388
1396
* given slot. For instance, the source slot may be VirtualTupleTableSlot, but
1389
1397
* the result slot may correspond to the table AM. On return the slot's
@@ -1393,10 +1401,11 @@ table_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
1393
1401
*/
1394
1402
static inline TupleTableSlot *
1395
1403
table_tuple_insert (Relation rel , TupleTableSlot * slot , CommandId cid ,
1396
- int options , struct BulkInsertStateData * bistate )
1404
+ int options , struct BulkInsertStateData * bistate ,
1405
+ bool * insert_indexes )
1397
1406
{
1398
1407
return rel -> rd_tableam -> tuple_insert (rel , slot , cid , options ,
1399
- bistate );
1408
+ bistate , insert_indexes );
1400
1409
}
1401
1410
1402
1411
/*
@@ -1448,10 +1457,11 @@ table_tuple_complete_speculative(Relation rel, TupleTableSlot *slot,
1448
1457
*/
1449
1458
static inline void
1450
1459
table_multi_insert (Relation rel , TupleTableSlot * * slots , int nslots ,
1451
- CommandId cid , int options , struct BulkInsertStateData * bistate )
1460
+ CommandId cid , int options , struct BulkInsertStateData * bistate ,
1461
+ bool * insert_indexes )
1452
1462
{
1453
1463
rel -> rd_tableam -> multi_insert (rel , slots , nslots ,
1454
- cid , options , bistate );
1464
+ cid , options , bistate , insert_indexes );
1455
1465
}
1456
1466
1457
1467
/*
@@ -2096,7 +2106,8 @@ table_scan_sample_next_tuple(TableScanDesc scan,
2096
2106
* ----------------------------------------------------------------------------
2097
2107
*/
2098
2108
2099
- extern void simple_table_tuple_insert (Relation rel , TupleTableSlot * slot );
2109
+ extern void simple_table_tuple_insert (Relation rel , TupleTableSlot * slot ,
2110
+ bool * insert_indexes );
2100
2111
extern void simple_table_tuple_delete (Relation rel , ItemPointer tid ,
2101
2112
Snapshot snapshot ,
2102
2113
TupleTableSlot * oldSlot );
0 commit comments