aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2018-11-15 14:26:14 -0800
committerAndres Freund <andres@anarazel.de>2018-11-15 14:31:12 -0800
commit763f2edd92095b1ca2f4476da073a28505c13820 (patch)
treeb053d30c95bf1ccf8b291462d654e4726624fe29 /src/backend/executor/nodeModifyTable.c
parent7ac0069fb880b9b64223f104058c82773321851c (diff)
downloadpostgresql-763f2edd92095b1ca2f4476da073a28505c13820.tar.gz
postgresql-763f2edd92095b1ca2f4476da073a28505c13820.zip
Rejigger materializing and fetching a HeapTuple from a slot.
Previously materializing a slot always returned a HeapTuple. As current work aims to reduce the reliance on HeapTuples (so other storage systems can work efficiently), that needs to change. Thus split the tasks of materializing a slot (i.e. making it independent from the underlying storage / other memory contexts) from fetching a HeapTuple from the slot. For brevity, allow to fetch a HeapTuple from a slot and materializing the slot at the same time, controlled by a parameter. For now some callers of ExecFetchSlotHeapTuple, with materialize = true, expect that changes to the heap tuple will be reflected in the underlying slot. Those places will be adapted in due course, so while not pretty, that's OK for now. Also rename ExecFetchSlotTuple to ExecFetchSlotHeapTupleDatum and ExecFetchSlotTupleDatum to ExecFetchSlotHeapTupleDatum, as it's likely that future storage methods will need similar methods. There already is ExecFetchSlotMinimalTuple, so the new names make the naming scheme more coherent. Author: Ashutosh Bapat and Andres Freund, with changes by Amit Khandekar Discussion: https://postgr.es/m/20181105210039.hh4vvi4vwoq5ba2q@alap3.anarazel.de
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
-rw-r--r--src/backend/executor/nodeModifyTable.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 6ef694d5a4a..a3ca336f2ac 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -175,7 +175,7 @@ ExecProcessReturning(ResultRelInfo *resultRelInfo,
* initialize t_tableOid before evaluating them.
*/
Assert(!TupIsNull(econtext->ecxt_scantuple));
- tuple = ExecMaterializeSlot(econtext->ecxt_scantuple);
+ tuple = ExecFetchSlotHeapTuple(econtext->ecxt_scantuple, true, NULL);
tuple->t_tableOid = RelationGetRelid(resultRelInfo->ri_RelationDesc);
}
econtext->ecxt_outertuple = planSlot;
@@ -274,7 +274,7 @@ ExecInsert(ModifyTableState *mtstate,
* get the heap tuple out of the tuple table slot, making sure we have a
* writable copy
*/
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
/*
* get information on the (current) result relation
@@ -315,7 +315,7 @@ ExecInsert(ModifyTableState *mtstate,
return NULL;
/* trigger might have changed tuple */
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
}
/* INSTEAD OF ROW INSERT Triggers */
@@ -328,7 +328,7 @@ ExecInsert(ModifyTableState *mtstate,
return NULL;
/* trigger might have changed tuple */
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
newId = InvalidOid;
}
@@ -346,7 +346,7 @@ ExecInsert(ModifyTableState *mtstate,
return NULL;
/* FDW might have changed tuple */
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
/*
* AFTER ROW Triggers or RETURNING expressions might reference the
@@ -695,7 +695,7 @@ ExecDelete(ModifyTableState *mtstate,
*/
if (TTS_EMPTY(slot))
ExecStoreAllNullTuple(slot);
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
tuple->t_tableOid = RelationGetRelid(resultRelationDesc);
}
else
@@ -953,7 +953,7 @@ ExecUpdate(ModifyTableState *mtstate,
* get the heap tuple out of the tuple table slot, making sure we have a
* writable copy
*/
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
/*
* get information on the (current) result relation
@@ -972,7 +972,7 @@ ExecUpdate(ModifyTableState *mtstate,
return NULL;
/* trigger might have changed tuple */
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
}
/* INSTEAD OF ROW UPDATE Triggers */
@@ -986,7 +986,7 @@ ExecUpdate(ModifyTableState *mtstate,
return NULL;
/* trigger might have changed tuple */
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
}
else if (resultRelInfo->ri_FdwRoutine)
{
@@ -1002,7 +1002,7 @@ ExecUpdate(ModifyTableState *mtstate,
return NULL;
/* FDW might have changed tuple */
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
/*
* AFTER ROW Triggers or RETURNING expressions might reference the
@@ -1129,7 +1129,7 @@ lreplace:;
else
{
slot = ExecFilterJunk(resultRelInfo->ri_junkFilter, epqslot);
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
goto lreplace;
}
}
@@ -1268,7 +1268,7 @@ lreplace:;
{
*tupleid = hufd.ctid;
slot = ExecFilterJunk(resultRelInfo->ri_junkFilter, epqslot);
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
goto lreplace;
}
}
@@ -1739,7 +1739,7 @@ ExecPrepareTupleRouting(ModifyTableState *mtstate,
estate->es_result_relation_info = partrel;
/* Get the heap tuple out of the given slot. */
- tuple = ExecMaterializeSlot(slot);
+ tuple = ExecFetchSlotHeapTuple(slot, true, NULL);
/*
* If we're capturing transition tuples, we might need to convert from the