summaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execMain.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 10a4b2ae876..7e12d6a1b02 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -1830,30 +1830,14 @@ ExecUpdate(TupleTableSlot *slot,
if (resultRelInfo->ri_TrigDesc &&
resultRelInfo->ri_TrigDesc->n_before_row[TRIGGER_EVENT_UPDATE] > 0)
{
- HeapTuple newtuple;
-
- newtuple = ExecBRUpdateTriggers(estate, resultRelInfo,
- tupleid, tuple);
+ slot = ExecBRUpdateTriggers(estate, resultRelInfo,
+ tupleid, slot);
- if (newtuple == NULL) /* "do nothing" */
+ if (slot == NULL) /* "do nothing" */
return;
- if (newtuple != tuple) /* modified by Trigger(s) */
- {
- /*
- * Put the modified tuple into a slot for convenience of routines
- * below. We assume the tuple was allocated in per-tuple memory
- * context, and therefore will go away by itself. The tuple table
- * slot should not try to clear it.
- */
- TupleTableSlot *newslot = estate->es_trig_tuple_slot;
-
- if (newslot->tts_tupleDescriptor != slot->tts_tupleDescriptor)
- ExecSetSlotDescriptor(newslot, slot->tts_tupleDescriptor);
- ExecStoreTuple(newtuple, newslot, InvalidBuffer, false);
- slot = newslot;
- tuple = newtuple;
- }
+ /* trigger might have changed tuple */
+ tuple = ExecMaterializeSlot(slot);
}
/*