diff options
Diffstat (limited to 'src/include/nodes/execnodes.h')
-rw-r--r-- | src/include/nodes/execnodes.h | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 09ea7ef6a6b..3b39369a492 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -356,10 +356,6 @@ typedef struct ProjectionInfo * attribute numbers of the "original" tuple and the * attribute numbers of the "clean" tuple. * resultSlot: tuple slot used to hold cleaned tuple. - * junkAttNo: not used by junkfilter code. Can be used by caller - * to remember the attno of a specific junk attribute - * (nodeModifyTable.c keeps the "ctid" or "wholerow" - * attno here). * ---------------- */ typedef struct JunkFilter @@ -369,7 +365,6 @@ typedef struct JunkFilter TupleDesc jf_cleanTupType; AttrNumber *jf_cleanMap; TupleTableSlot *jf_resultSlot; - AttrNumber jf_junkAttNo; } JunkFilter; /* @@ -423,6 +418,19 @@ typedef struct ResultRelInfo /* array of key/attr info for indices */ IndexInfo **ri_IndexRelationInfo; + /* + * For UPDATE/DELETE result relations, the attribute number of the row + * identity junk attribute in the source plan's output tuples + */ + AttrNumber ri_RowIdAttNo; + + /* Projection to generate new tuple in an INSERT/UPDATE */ + ProjectionInfo *ri_projectNew; + /* Slot to hold that tuple */ + TupleTableSlot *ri_newTupleSlot; + /* Slot to hold the old tuple being updated */ + TupleTableSlot *ri_oldTupleSlot; + /* triggers to be fired, if any */ TriggerDesc *ri_TrigDesc; @@ -470,9 +478,6 @@ typedef struct ResultRelInfo /* number of stored generated columns we need to compute */ int ri_NumGeneratedNeeded; - /* for removing junk attributes from tuples */ - JunkFilter *ri_junkFilter; - /* list of RETURNING expressions */ List *ri_returningList; @@ -677,10 +682,7 @@ typedef struct ExecRowMark * Each LockRows and ModifyTable node keeps a list of the rowmarks it needs to * deal with. In addition to a pointer to the related entry in es_rowmarks, * this struct carries the column number(s) of the resjunk columns associated - * with the rowmark (see comments for PlanRowMark for more detail). In the - * case of ModifyTable, there has to be a separate ExecAuxRowMark list for - * each child plan, because the resjunk columns could be at different physical - * column positions in different subplans. + * with the rowmark (see comments for PlanRowMark for more detail). */ typedef struct ExecAuxRowMark { @@ -1082,9 +1084,8 @@ typedef struct PlanState * EvalPlanQualSlot), and/or found using the rowmark mechanism (non-locking * rowmarks by the EPQ machinery itself, locking ones by the caller). * - * While the plan to be checked may be changed using EvalPlanQualSetPlan() - - * e.g. so all source plans for a ModifyTable node can be processed - all such - * plans need to share the same EState. + * While the plan to be checked may be changed using EvalPlanQualSetPlan(), + * all such plans need to share the same EState. */ typedef struct EPQState { @@ -1178,24 +1179,32 @@ typedef struct ModifyTableState CmdType operation; /* INSERT, UPDATE, or DELETE */ bool canSetTag; /* do we set the command tag/es_processed? */ bool mt_done; /* are we done? */ - PlanState **mt_plans; /* subplans (one per target rel) */ - int mt_nplans; /* number of plans in the array */ - int mt_whichplan; /* which one is being executed (0..n-1) */ - TupleTableSlot **mt_scans; /* input tuple corresponding to underlying - * plans */ - ResultRelInfo *resultRelInfo; /* per-subplan target relations */ + int mt_nrels; /* number of entries in resultRelInfo[] */ + ResultRelInfo *resultRelInfo; /* info about target relation(s) */ /* * Target relation mentioned in the original statement, used to fire - * statement-level triggers and as the root for tuple routing. + * statement-level triggers and as the root for tuple routing. (This + * might point to one of the resultRelInfo[] entries, but it can also be a + * distinct struct.) */ ResultRelInfo *rootResultRelInfo; - List **mt_arowmarks; /* per-subplan ExecAuxRowMark lists */ EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */ bool fireBSTriggers; /* do we need to fire stmt triggers? */ /* + * These fields are used for inherited UPDATE and DELETE, to track which + * target relation a given tuple is from. If there are a lot of target + * relations, we use a hash table to translate table OIDs to + * resultRelInfo[] indexes; otherwise mt_resultOidHash is NULL. + */ + int mt_resultOidAttno; /* resno of "tableoid" junk attr */ + Oid mt_lastResultOid; /* last-seen value of tableoid */ + int mt_lastResultIndex; /* corresponding index in resultRelInfo[] */ + HTAB *mt_resultOidHash; /* optional hash table to speed lookups */ + + /* * Slot for storing tuples in the root partitioned table's rowtype during * an UPDATE of a partitioned table. */ |