Skip to content

Commit 8dd0bb8

Browse files
committed
Revert: Allow table AM tuple_insert() method to return the different slot
This commit reverts c35a3fb per review by Andres Freund. Discussion: https://postgr.es/m/20240410165236.rwyrny7ihi4ddxw4%40awork3.anarazel.de
1 parent 193e6d1 commit 8dd0bb8

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

src/backend/access/heap/heapam_handler.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ heapam_tuple_satisfies_snapshot(Relation rel, TupleTableSlot *slot,
238238
* ----------------------------------------------------------------------------
239239
*/
240240

241-
static TupleTableSlot *
241+
static void
242242
heapam_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
243243
int options, BulkInsertState bistate)
244244
{
@@ -255,8 +255,6 @@ heapam_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
255255

256256
if (shouldFree)
257257
pfree(tuple);
258-
259-
return slot;
260258
}
261259

262260
static void

src/backend/commands/tablecmds.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21086,8 +21086,8 @@ moveSplitTableRows(Relation rel, Relation splitRel, List *partlist, List *newPar
2108621086
}
2108721087

2108821088
/* Write the tuple out to the new relation. */
21089-
(void) table_tuple_insert(pc->partRel, insertslot, mycid,
21090-
ti_options, pc->bistate);
21089+
table_tuple_insert(pc->partRel, insertslot, mycid,
21090+
ti_options, pc->bistate);
2109121091

2109221092
ResetExprContext(econtext);
2109321093

@@ -21381,8 +21381,8 @@ moveMergedTablesRows(Relation rel, List *mergingPartitionsList,
2138121381
}
2138221382

2138321383
/* Write the tuple out to the new relation. */
21384-
(void) table_tuple_insert(newPartRel, insertslot, mycid,
21385-
ti_options, bistate);
21384+
table_tuple_insert(newPartRel, insertslot, mycid,
21385+
ti_options, bistate);
2138621386

2138721387
CHECK_FOR_INTERRUPTS();
2138821388
}

src/backend/executor/nodeModifyTable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,9 +1127,9 @@ ExecInsert(ModifyTableContext *context,
11271127
else
11281128
{
11291129
/* insert the tuple normally */
1130-
slot = table_tuple_insert(resultRelationDesc, slot,
1131-
estate->es_output_cid,
1132-
0, NULL);
1130+
table_tuple_insert(resultRelationDesc, slot,
1131+
estate->es_output_cid,
1132+
0, NULL);
11331133

11341134
/* insert index entries for tuple */
11351135
if (resultRelInfo->ri_NumIndices > 0)

src/include/access/tableam.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,9 @@ typedef struct TableAmRoutine
508508
*/
509509

510510
/* see table_tuple_insert() for reference about parameters */
511-
TupleTableSlot *(*tuple_insert) (Relation rel, TupleTableSlot *slot,
512-
CommandId cid, int options,
513-
struct BulkInsertStateData *bistate);
511+
void (*tuple_insert) (Relation rel, TupleTableSlot *slot,
512+
CommandId cid, int options,
513+
struct BulkInsertStateData *bistate);
514514

515515
/* see table_tuple_insert_speculative() for reference about parameters */
516516
void (*tuple_insert_speculative) (Relation rel,
@@ -1374,19 +1374,16 @@ table_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
13741374
* behavior) is also just passed through to RelationGetBufferForTuple. If
13751375
* `bistate` is provided, table_finish_bulk_insert() needs to be called.
13761376
*
1377-
* Returns the slot containing the inserted tuple, which may differ from the
1378-
* given slot. For instance, the source slot may be VirtualTupleTableSlot, but
1379-
* the result slot may correspond to the table AM. On return the slot's
1380-
* tts_tid and tts_tableOid are updated to reflect the insertion. But note
1381-
* that any toasting of fields within the slot is NOT reflected in the slots
1382-
* contents.
1377+
* On return the slot's tts_tid and tts_tableOid are updated to reflect the
1378+
* insertion. But note that any toasting of fields within the slot is NOT
1379+
* reflected in the slots contents.
13831380
*/
1384-
static inline TupleTableSlot *
1381+
static inline void
13851382
table_tuple_insert(Relation rel, TupleTableSlot *slot, CommandId cid,
13861383
int options, struct BulkInsertStateData *bistate)
13871384
{
1388-
return rel->rd_tableam->tuple_insert(rel, slot, cid, options,
1389-
bistate);
1385+
rel->rd_tableam->tuple_insert(rel, slot, cid, options,
1386+
bistate);
13901387
}
13911388

13921389
/*

0 commit comments

Comments
 (0)