aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2024-04-11 15:53:26 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2024-04-11 16:02:45 +0300
commit8dd0bb84da7d56a9e41241b26bfbf6b79644d574 (patch)
treed429168e3a5bddfc1c18c170b2965f436500eb37
parent193e6d18e553a104d315ff81892d509d89a30fd8 (diff)
downloadpostgresql-8dd0bb84da7d56a9e41241b26bfbf6b79644d574.tar.gz
postgresql-8dd0bb84da7d56a9e41241b26bfbf6b79644d574.zip
Revert: Allow table AM tuple_insert() method to return the different slot
This commit reverts c35a3fb5e0 per review by Andres Freund. Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de
-rw-r--r--src/backend/access/heap/heapam_handler.c4
-rw-r--r--src/backend/commands/tablecmds.c8
-rw-r--r--src/backend/executor/nodeModifyTable.c6
-rw-r--r--src/include/access/tableam.h21
4 files changed, 17 insertions, 22 deletions
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c
index cf41ab239ed..c019d96a162 100644
--- a/src/backend/access/heap/heapam_handler.c
+++ b/src/backend/access/heap/heapam_handler.c
@@ -238,7 +238,7 @@ heapam_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot,
* ----------------------------------------------------------------------------
*/
-static TupleTableSlot *
+static void
heapam_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
int options, BulkInsertState bistate)
{
@@ -255,8 +255,6 @@ heapam_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
if (shouldFree)
pfree(tuple);
-
- return slot;
}
static void
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 571feea270e..000212f24c4 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -21086,8 +21086,8 @@ moveSplitTableRows(Relation rel, Relation splitRel, List *partlist, List *newPar
}
/* Write the tuple out to the new relation. */
- (void) table_tuple_insert(pc->partRel, insertslot, mycid,
- ti_options, pc->bistate);
+ table_tuple_insert(pc->partRel, insertslot, mycid,
+ ti_options, pc->bistate);
ResetExprContext(econtext);
@@ -21381,8 +21381,8 @@ moveMergedTablesRows(Relation rel, List *mergingPartitionsList,
}
/* Write the tuple out to the new relation. */
- (void) table_tuple_insert(newPartRel, insertslot, mycid,
- ti_options, bistate);
+ table_tuple_insert(newPartRel, insertslot, mycid,
+ ti_options, bistate);
CHECK_FOR_INTERRUPTS();
}
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index c570965da09..cee60d3659b 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -1127,9 +1127,9 @@ ExecInsert(ModifyTableContext *context,
else
{
/* insert the tuple normally */
- slot = table_tuple_insert(resultRelationDesc, slot,
- estate->es_output_cid,
- 0, NULL);
+ table_tuple_insert(resultRelationDesc, slot,
+ estate->es_output_cid,
+ 0, NULL);
/* insert index entries for tuple */
if (resultRelInfo->ri_NumIndices > 0)
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index 6ef7714d2bc..ac24c999453 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -508,9 +508,9 @@ typedef struct TableAmRoutine
*/
/* see table_tuple_insert() for reference about parameters */
- TupleTableSlot *(*tuple_insert) (Relation rel, TupleTableSlot *slot,
- CommandId cid, int options,
- struct BulkInsertStateData *bistate);
+ void (*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,
@@ -1374,19 +1374,16 @@ 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.
*
- * 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.
+ * 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 TupleTableSlot *
+static inline void
table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid,
int options, struct BulkInsertStateData *bistate)
{
- return rel->rd_tableam->tuple_insert(rel, slot, cid, options,
- bistate);
+ rel->rd_tableam->tuple_insert(rel, slot, cid, options,
+ bistate);
}
/*