summaryrefslogtreecommitdiff
path: root/src/include/access
diff options
context:
space:
mode:
authorAlexander Korotkov2024-03-21 21:00:40 +0000
committerAlexander Korotkov2024-03-21 21:00:40 +0000
commitc35a3fb5e067fc95f13206418e3785d2cb059da1 (patch)
treecc2405cdee74e4550943374264c0ede23aaf9d18 /src/include/access
parent02eb07ea89d27f1d05a5055bf779042d2953b4e7 (diff)
Allow table AM tuple_insert() method to return the different slot
This allows table AM to return a native tuple slot even if VirtualTupleTableSlot is given as an input. Native tuple slots have knowledge about system attributes, which could be accessed in the future. table_multi_insert() method already can modify the input 'slots' array. Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com Reviewed-by: Matthias van de Meent, Mark Dilger, Pavel Borisov Reviewed-by: Nikita Malakhov, Japin Li
Diffstat (limited to 'src/include/access')
-rw-r--r--src/include/access/tableam.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index fd474b74883..65834caeb1c 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -500,9 +500,9 @@ typedef struct TableAmRoutine
*/
/* see table_tuple_insert() for reference about parameters */
- void (*tuple_insert) (Relation rel, TupleTableSlot *slot,
- CommandId cid, int options,
- struct BulkInsertStateData *bistate);
+ TupleTableSlot *(*tuple_insert) (Relation rel, TupleTableSlot *slot,
+ CommandId cid, int options,
+ struct BulkInsertStateData *bistate);
/* see table_tuple_insert_speculative() for reference about parameters */
void (*tuple_insert_speculative) (Relation rel,
@@ -1392,16 +1392,19 @@ table_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
* behavior) is also just passed through to RelationGetBufferForTuple. If
* `bistate` is provided, table_finish_bulk_insert() needs to be called.
*
- * On return the slot's tts_tid and tts_tableOid are updated to reflect the
- * insertion. But note that any toasting of fields within the slot is NOT
- * reflected in the slots contents.
+ * Returns the slot containing the inserted tuple, which may differ from the
+ * given slot. For instance, the source slot may be VirtualTupleTableSlot, but
+ * the result slot may correspond to the table AM. On return the slot's
+ * tts_tid and tts_tableOid are updated to reflect the insertion. But note
+ * that any toasting of fields within the slot is NOT reflected in the slots
+ * contents.
*/
-static inline void
+static inline TupleTableSlot *
table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid,
int options, struct BulkInsertStateData *bistate)
{
- rel->rd_tableam->tuple_insert(rel, slot, cid, options,
- bistate);
+ return rel->rd_tableam->tuple_insert(rel, slot, cid, options,
+ bistate);
}
/*