From ff11e7f4b9ae017585c3ba146db7ba39c31f209a Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 26 Feb 2019 20:30:28 -0800 Subject: Use slots in trigger infrastructure, except for the actual invocation. In preparation for abstracting table storage, convert trigger.c to track tuples in slots. Which also happens to make code calling triggers simpler. As the calling interface for triggers themselves is not changed in this patch, HeapTuples still are extracted from the slot at that time. But that's handled solely inside trigger.c, not visible to callers. It's quite likely that we'll want to revise the external trigger interface, but that's a separate large project. As part of this work the slots used for old/new/return tuples are moved from EState into ResultRelInfo, as different updated tables might need different slots. The slots are now also now created on-demand, which is good both from an efficiency POV, but also makes the modifying code simpler. Author: Andres Freund, Amit Khandekar and Ashutosh Bapat Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de --- src/backend/executor/execMain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/executor/execMain.c') diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 9a20460e762..00d8e8fc585 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -975,9 +975,6 @@ InitPlan(QueryDesc *queryDesc, int eflags) * Initialize the executor's tuple table to empty. */ estate->es_tupleTable = NIL; - estate->es_trig_tuple_slot = NULL; - estate->es_trig_oldtup_slot = NULL; - estate->es_trig_newtup_slot = NULL; /* mark EvalPlanQual not active */ estate->es_epqTuple = NULL; @@ -1324,6 +1321,9 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo, resultRelInfo->ri_projectReturning = NULL; resultRelInfo->ri_onConflictArbiterIndexes = NIL; resultRelInfo->ri_onConflict = NULL; + resultRelInfo->ri_ReturningSlot = NULL; + resultRelInfo->ri_TrigOldSlot = NULL; + resultRelInfo->ri_TrigNewSlot = NULL; /* * Partition constraint, which also includes the partition constraint of -- cgit v1.2.3