diff options
Diffstat (limited to 'src/include/nodes/execnodes.h')
-rw-r--r-- | src/include/nodes/execnodes.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index f34d06eff4f..9fa23e2bb66 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1153,17 +1153,17 @@ typedef struct PlanState */ typedef struct EPQState { - /* Initialized at EvalPlanQualInit() time: */ - + /* These are initialized by EvalPlanQualInit() and do not change later: */ EState *parentestate; /* main query's EState */ int epqParam; /* ID of Param to force scan node re-eval */ + struct EPQStateExtra *epqExtra; /* extension pointer to avoid ABI break */ /* - * Tuples to be substituted by scan nodes. They need to set up, before - * calling EvalPlanQual()/EvalPlanQualNext(), into the slot returned by - * EvalPlanQualSlot(scanrelid). The array is indexed by scanrelid - 1. + * relsubs_slot[scanrelid - 1] holds the EPQ test tuple to be returned by + * the scan node for the scanrelid'th RT index, in place of performing an + * actual table scan. Callers should use EvalPlanQualSlot() to fetch + * these slots. */ - List *tuple_table; /* tuple table for relsubs_slot */ TupleTableSlot **relsubs_slot; /* @@ -1195,8 +1195,9 @@ typedef struct EPQState ExecAuxRowMark **relsubs_rowmark; /* - * True if a relation's EPQ tuple has been fetched for relation, indexed - * by scanrelid - 1. + * relsubs_done[scanrelid - 1] is true if there is no EPQ tuple for this + * target relation or it has already been fetched in the current scan of + * this target relation within the current EvalPlanQual test. */ bool *relsubs_done; @@ -1204,6 +1205,25 @@ typedef struct EPQState } EPQState; +/* + * To avoid an ABI-breaking change in the size of EPQState in back branches, + * we create one of these during EvalPlanQualInit. + */ +typedef struct EPQStateExtra +{ + List *resultRelations; /* integer list of RT indexes, or NIL */ + List *tuple_table; /* tuple table for relsubs_slot */ + + /* + * relsubs_blocked[scanrelid - 1] is true if there is no EPQ tuple for + * this target relation during the current EvalPlanQual test. We keep + * these flags set for all relids listed in resultRelations, but + * transiently clear the one for the relation whose tuple is actually + * passed to EvalPlanQual(). + */ + bool *relsubs_blocked; +} EPQStateExtra; + /* ---------------- * ResultState information * ---------------- |