]> granicus.if.org Git - postgresql/blob - src/include/nodes/execnodes.h
Change the implementation of hash join to attempt to avoid unnecessary
[postgresql] / src / include / nodes / execnodes.h
1 /*-------------------------------------------------------------------------
2  *
3  * execnodes.h
4  *        definitions for executor state nodes
5  *
6  *
7  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.134 2005/06/15 07:27:44 neilc Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef EXECNODES_H
15 #define EXECNODES_H
16
17 #include "access/relscan.h"
18 #include "executor/tuptable.h"
19 #include "fmgr.h"
20 #include "nodes/bitmapset.h"
21 #include "nodes/params.h"
22 #include "nodes/plannodes.h"
23 #include "nodes/tidbitmap.h"
24 #include "utils/hsearch.h"
25 #include "utils/tuplestore.h"
26
27
28 /* ----------------
29  *        IndexInfo information
30  *
31  *              this struct holds the information needed to construct new index
32  *              entries for a particular index.  Used for both index_build and
33  *              retail creation of index entries.
34  *
35  *              NumIndexAttrs           number of columns in this index
36  *              KeyAttrNumbers          underlying-rel attribute numbers used as keys
37  *                                                      (zeroes indicate expressions)
38  *              Expressions                     expr trees for expression entries, or NIL if none
39  *              ExpressionsState        exec state for expressions, or NIL if none
40  *              Predicate                       partial-index predicate, or NIL if none
41  *              PredicateState          exec state for predicate, or NIL if none
42  *              Unique                          is it a unique index?
43  * ----------------
44  */
45 typedef struct IndexInfo
46 {
47         NodeTag         type;
48         int                     ii_NumIndexAttrs;
49         AttrNumber      ii_KeyAttrNumbers[INDEX_MAX_KEYS];
50         List       *ii_Expressions; /* list of Expr */
51         List       *ii_ExpressionsState;        /* list of ExprState */
52         List       *ii_Predicate;       /* list of Expr */
53         List       *ii_PredicateState;          /* list of ExprState */
54         bool            ii_Unique;
55 } IndexInfo;
56
57 /* ----------------
58  *        ExprContext_CB
59  *
60  *              List of callbacks to be called at ExprContext shutdown.
61  * ----------------
62  */
63 typedef void (*ExprContextCallbackFunction) (Datum arg);
64
65 typedef struct ExprContext_CB
66 {
67         struct ExprContext_CB *next;
68         ExprContextCallbackFunction function;
69         Datum           arg;
70 } ExprContext_CB;
71
72 /* ----------------
73  *        ExprContext
74  *
75  *              This class holds the "current context" information
76  *              needed to evaluate expressions for doing tuple qualifications
77  *              and tuple projections.  For example, if an expression refers
78  *              to an attribute in the current inner tuple then we need to know
79  *              what the current inner tuple is and so we look at the expression
80  *              context.
81  *
82  *      There are two memory contexts associated with an ExprContext:
83  *      * ecxt_per_query_memory is a query-lifespan context, typically the same
84  *        context the ExprContext node itself is allocated in.  This context
85  *        can be used for purposes such as storing function call cache info.
86  *      * ecxt_per_tuple_memory is a short-term context for expression results.
87  *        As the name suggests, it will typically be reset once per tuple,
88  *        before we begin to evaluate expressions for that tuple.  Each
89  *        ExprContext normally has its very own per-tuple memory context.
90  *
91  *      CurrentMemoryContext should be set to ecxt_per_tuple_memory before
92  *      calling ExecEvalExpr() --- see ExecEvalExprSwitchContext().
93  * ----------------
94  */
95 typedef struct ExprContext
96 {
97         NodeTag         type;
98
99         /* Tuples that Var nodes in expression may refer to */
100         TupleTableSlot *ecxt_scantuple;
101         TupleTableSlot *ecxt_innertuple;
102         TupleTableSlot *ecxt_outertuple;
103
104         /* Memory contexts for expression evaluation --- see notes above */
105         MemoryContext ecxt_per_query_memory;
106         MemoryContext ecxt_per_tuple_memory;
107
108         /* Values to substitute for Param nodes in expression */
109         ParamExecData *ecxt_param_exec_vals;            /* for PARAM_EXEC params */
110         ParamListInfo ecxt_param_list_info; /* for other param types */
111
112         /* Values to substitute for Aggref nodes in expression */
113         Datum      *ecxt_aggvalues; /* precomputed values for Aggref nodes */
114         bool       *ecxt_aggnulls;      /* null flags for Aggref nodes */
115
116         /* Value to substitute for CaseTestExpr nodes in expression */
117         Datum           caseValue_datum;
118         bool            caseValue_isNull;
119
120         /* Value to substitute for CoerceToDomainValue nodes in expression */
121         Datum           domainValue_datum;
122         bool            domainValue_isNull;
123
124         /* Link to containing EState */
125         struct EState *ecxt_estate;
126
127         /* Functions to call back when ExprContext is shut down */
128         ExprContext_CB *ecxt_callbacks;
129 } ExprContext;
130
131 /*
132  * Set-result status returned by ExecEvalExpr()
133  */
134 typedef enum
135 {
136         ExprSingleResult,                       /* expression does not return a set */
137         ExprMultipleResult,                     /* this result is an element of a set */
138         ExprEndResult                           /* there are no more elements in the set */
139 } ExprDoneCond;
140
141 /*
142  * Return modes for functions returning sets.  Note values must be chosen
143  * as separate bits so that a bitmask can be formed to indicate supported
144  * modes.
145  */
146 typedef enum
147 {
148         SFRM_ValuePerCall = 0x01,       /* one value returned per call */
149         SFRM_Materialize = 0x02         /* result set instantiated in Tuplestore */
150 } SetFunctionReturnMode;
151
152 /*
153  * When calling a function that might return a set (multiple rows),
154  * a node of this type is passed as fcinfo->resultinfo to allow
155  * return status to be passed back.  A function returning set should
156  * raise an error if no such resultinfo is provided.
157  */
158 typedef struct ReturnSetInfo
159 {
160         NodeTag         type;
161         /* values set by caller: */
162         ExprContext *econtext;          /* context function is being called in */
163         TupleDesc       expectedDesc;   /* tuple descriptor expected by caller */
164         int                     allowedModes;   /* bitmask: return modes caller can handle */
165         /* result status from function (but pre-initialized by caller): */
166         SetFunctionReturnMode returnMode;       /* actual return mode */
167         ExprDoneCond isDone;            /* status for ValuePerCall mode */
168         /* fields filled by function in Materialize return mode: */
169         Tuplestorestate *setResult; /* holds the complete returned tuple set */
170         TupleDesc       setDesc;                /* actual descriptor for returned tuples */
171 } ReturnSetInfo;
172
173 /* ----------------
174  *              ProjectionInfo node information
175  *
176  *              This is all the information needed to perform projections ---
177  *              that is, form new tuples by evaluation of targetlist expressions.
178  *              Nodes which need to do projections create one of these.
179  *
180  *              ExecProject() evaluates the tlist, forms a tuple, and stores it
181  *              in the given slot.      Note that the result will be a "virtual" tuple
182  *              unless ExecMaterializeSlot() is then called to force it to be
183  *              converted to a physical tuple.  The slot must have a tupledesc
184  *              that matches the output of the tlist!
185  *
186  *              The planner very often produces tlists that consist entirely of
187  *              simple Var references (lower levels of a plan tree almost always
188  *              look like that).  So we have an optimization to handle that case
189  *              with minimum overhead.
190  *
191  *              targetlist              target list for projection
192  *              exprContext             expression context in which to evaluate targetlist
193  *              slot                    slot to place projection result in
194  *              itemIsDone              workspace for ExecProject
195  *              isVarList               TRUE if simple-Var-list optimization applies
196  *              varSlotOffsets  array indicating which slot each simple Var is from
197  *              varNumbers              array indicating attr numbers of simple Vars
198  *              lastInnerVar    highest attnum from inner tuple slot (0 if none)
199  *              lastOuterVar    highest attnum from outer tuple slot (0 if none)
200  *              lastScanVar             highest attnum from scan tuple slot (0 if none)
201  * ----------------
202  */
203 typedef struct ProjectionInfo
204 {
205         NodeTag         type;
206         List       *pi_targetlist;
207         ExprContext *pi_exprContext;
208         TupleTableSlot *pi_slot;
209         ExprDoneCond *pi_itemIsDone;
210         bool            pi_isVarList;
211         int                *pi_varSlotOffsets;
212         int                *pi_varNumbers;
213         int                     pi_lastInnerVar;
214         int                     pi_lastOuterVar;
215         int                     pi_lastScanVar;
216 } ProjectionInfo;
217
218 /* ----------------
219  *        JunkFilter
220  *
221  *        This class is used to store information regarding junk attributes.
222  *        A junk attribute is an attribute in a tuple that is needed only for
223  *        storing intermediate information in the executor, and does not belong
224  *        in emitted tuples.  For example, when we do an UPDATE query,
225  *        the planner adds a "junk" entry to the targetlist so that the tuples
226  *        returned to ExecutePlan() contain an extra attribute: the ctid of
227  *        the tuple to be updated.      This is needed to do the update, but we
228  *        don't want the ctid to be part of the stored new tuple!  So, we
229  *        apply a "junk filter" to remove the junk attributes and form the
230  *        real output tuple.
231  *
232  *        targetList:           the original target list (including junk attributes).
233  *        cleanTupType:         the tuple descriptor for the "clean" tuple (with
234  *                                              junk attributes removed).
235  *        cleanMap:                     A map with the correspondence between the non-junk
236  *                                              attribute numbers of the "original" tuple and the
237  *                                              attribute numbers of the "clean" tuple.
238  *        resultSlot:           tuple slot used to hold cleaned tuple.
239  * ----------------
240  */
241 typedef struct JunkFilter
242 {
243         NodeTag         type;
244         List       *jf_targetList;
245         TupleDesc       jf_cleanTupType;
246         AttrNumber *jf_cleanMap;
247         TupleTableSlot *jf_resultSlot;
248 } JunkFilter;
249
250 /* ----------------
251  *        ResultRelInfo information
252  *
253  *              Whenever we update an existing relation, we have to
254  *              update indices on the relation, and perhaps also fire triggers.
255  *              The ResultRelInfo class is used to hold all the information needed
256  *              about a result relation, including indices.. -cim 10/15/89
257  *
258  *              RangeTableIndex                 result relation's range table index
259  *              RelationDesc                    relation descriptor for result relation
260  *              NumIndices                              # of indices existing on result relation
261  *              IndexRelationDescs              array of relation descriptors for indices
262  *              IndexRelationInfo               array of key/attr info for indices
263  *              TrigDesc                                triggers to be fired, if any
264  *              TrigFunctions                   cached lookup info for trigger functions
265  *              TrigInstrument                  optional runtime measurements for triggers
266  *              ConstraintExprs                 array of constraint-checking expr states
267  *              junkFilter                              for removing junk attributes from tuples
268  * ----------------
269  */
270 typedef struct ResultRelInfo
271 {
272         NodeTag         type;
273         Index           ri_RangeTableIndex;
274         Relation        ri_RelationDesc;
275         int                     ri_NumIndices;
276         RelationPtr ri_IndexRelationDescs;
277         IndexInfo **ri_IndexRelationInfo;
278         TriggerDesc *ri_TrigDesc;
279         FmgrInfo   *ri_TrigFunctions;
280         struct Instrumentation *ri_TrigInstrument;
281         List      **ri_ConstraintExprs;
282         JunkFilter *ri_junkFilter;
283 } ResultRelInfo;
284
285 /* ----------------
286  *        EState information
287  *
288  * Master working state for an Executor invocation
289  * ----------------
290  */
291 typedef struct EState
292 {
293         NodeTag         type;
294
295         /* Basic state for all query types: */
296         ScanDirection es_direction; /* current scan direction */
297         Snapshot        es_snapshot;    /* time qual to use */
298         Snapshot        es_crosscheck_snapshot; /* crosscheck time qual for RI */
299         List       *es_range_table; /* List of RangeTableEntrys */
300
301         /* Info about target table for insert/update/delete queries: */
302         ResultRelInfo *es_result_relations; /* array of ResultRelInfos */
303         int                     es_num_result_relations;                /* length of array */
304         ResultRelInfo *es_result_relation_info;         /* currently active array
305                                                                                                  * elt */
306         JunkFilter *es_junkFilter;      /* currently active junk filter */
307         Relation        es_into_relation_descriptor;    /* for SELECT INTO */
308
309         /* Parameter info: */
310         ParamListInfo es_param_list_info;       /* values of external params */
311         ParamExecData *es_param_exec_vals;      /* values of internal params */
312
313         /* Other working state: */
314         MemoryContext es_query_cxt; /* per-query context in which EState lives */
315
316         TupleTable      es_tupleTable;  /* Array of TupleTableSlots */
317
318         uint32          es_processed;   /* # of tuples processed */
319         Oid                     es_lastoid;             /* last oid processed (by INSERT) */
320         List       *es_rowMark;         /* not good place, but there is no other */
321         bool            es_forUpdate;   /* was it FOR UPDATE or FOR SHARE */
322
323         bool            es_instrument;  /* true requests runtime instrumentation */
324         bool            es_select_into; /* true if doing SELECT INTO */
325         bool            es_into_oids;   /* true to generate OIDs in SELECT INTO */
326
327         List       *es_exprcontexts;    /* List of ExprContexts within EState */
328
329         /*
330          * this ExprContext is for per-output-tuple operations, such as
331          * constraint checks and index-value computations.      It will be reset
332          * for each output tuple.  Note that it will be created only if
333          * needed.
334          */
335         ExprContext *es_per_tuple_exprcontext;
336
337         /* Below is to re-evaluate plan qual in READ COMMITTED mode */
338         Plan       *es_topPlan;         /* link to top of plan tree */
339         struct evalPlanQual *es_evalPlanQual;           /* chain of PlanQual
340                                                                                                  * states */
341         bool       *es_evTupleNull; /* local array of EPQ status */
342         HeapTuple  *es_evTuple;         /* shared array of EPQ substitute tuples */
343         bool            es_useEvalPlan; /* evaluating EPQ tuples? */
344 } EState;
345
346
347 /* ----------------------------------------------------------------
348  *                               Tuple Hash Tables
349  *
350  * All-in-memory tuple hash tables are used for a number of purposes.
351  * ----------------------------------------------------------------
352  */
353 typedef struct TupleHashEntryData *TupleHashEntry;
354 typedef struct TupleHashTableData *TupleHashTable;
355
356 typedef struct TupleHashEntryData
357 {
358         /* firstTuple must be the first field in this struct! */
359         HeapTuple       firstTuple;             /* copy of first tuple in this group */
360         /* there may be additional data beyond the end of this struct */
361 } TupleHashEntryData;                   /* VARIABLE LENGTH STRUCT */
362
363 typedef struct TupleHashTableData
364 {
365         HTAB       *hashtab;            /* underlying dynahash table */
366         int                     numCols;                /* number of columns in lookup key */
367         AttrNumber *keyColIdx;          /* attr numbers of key columns */
368         FmgrInfo   *eqfunctions;        /* lookup data for comparison functions */
369         FmgrInfo   *hashfunctions;      /* lookup data for hash functions */
370         MemoryContext tablecxt;         /* memory context containing table */
371         MemoryContext tempcxt;          /* context for function evaluations */
372         Size            entrysize;              /* actual size to make each hash entry */
373         TupleTableSlot *tableslot;      /* slot for referencing table entries */
374         TupleTableSlot *inputslot;      /* current input tuple's slot */
375 } TupleHashTableData;
376
377 typedef HASH_SEQ_STATUS TupleHashIterator;
378
379 #define ResetTupleHashIterator(htable, iter) \
380         hash_seq_init(iter, (htable)->hashtab)
381 #define ScanTupleHashTable(iter) \
382         ((TupleHashEntry) hash_seq_search(iter))
383
384
385 /* ----------------------------------------------------------------
386  *                               Expression State Trees
387  *
388  * Each executable expression tree has a parallel ExprState tree.
389  *
390  * Unlike PlanState, there is not an exact one-for-one correspondence between
391  * ExprState node types and Expr node types.  Many Expr node types have no
392  * need for node-type-specific run-time state, and so they can use plain
393  * ExprState or GenericExprState as their associated ExprState node type.
394  * ----------------------------------------------------------------
395  */
396
397 /* ----------------
398  *              ExprState node
399  *
400  * ExprState is the common superclass for all ExprState-type nodes.
401  *
402  * It can also be instantiated directly for leaf Expr nodes that need no
403  * local run-time state (such as Var, Const, or Param).
404  *
405  * To save on dispatch overhead, each ExprState node contains a function
406  * pointer to the routine to execute to evaluate the node.
407  * ----------------
408  */
409
410 typedef struct ExprState ExprState;
411
412 typedef Datum (*ExprStateEvalFunc) (ExprState *expression,
413                                                                                                 ExprContext *econtext,
414                                                                                                 bool *isNull,
415                                                                                                 ExprDoneCond *isDone);
416
417 struct ExprState
418 {
419         NodeTag         type;
420         Expr       *expr;                       /* associated Expr node */
421         ExprStateEvalFunc evalfunc; /* routine to run to execute node */
422 };
423
424 /* ----------------
425  *              GenericExprState node
426  *
427  * This is used for Expr node types that need no local run-time state,
428  * but have one child Expr node.
429  * ----------------
430  */
431 typedef struct GenericExprState
432 {
433         ExprState       xprstate;
434         ExprState  *arg;                        /* state of my child node */
435 } GenericExprState;
436
437 /* ----------------
438  *              AggrefExprState node
439  * ----------------
440  */
441 typedef struct AggrefExprState
442 {
443         ExprState       xprstate;
444         ExprState  *target;                     /* state of my child node */
445         int                     aggno;                  /* ID number for agg within its plan node */
446 } AggrefExprState;
447
448 /* ----------------
449  *              ArrayRefExprState node
450  *
451  * Note: array types can be fixed-length (typlen > 0), but only when the
452  * element type is itself fixed-length.  Otherwise they are varlena structures
453  * and have typlen = -1.  In any case, an array type is never pass-by-value.
454  * ----------------
455  */
456 typedef struct ArrayRefExprState
457 {
458         ExprState       xprstate;
459         List       *refupperindexpr;    /* states for child nodes */
460         List       *reflowerindexpr;
461         ExprState  *refexpr;
462         ExprState  *refassgnexpr;
463         int16           refattrlength;  /* typlen of array type */
464         int16           refelemlength;  /* typlen of the array element type */
465         bool            refelembyval;   /* is the element type pass-by-value? */
466         char            refelemalign;   /* typalign of the element type */
467 } ArrayRefExprState;
468
469 /* ----------------
470  *              FuncExprState node
471  *
472  * Although named for FuncExpr, this is also used for OpExpr, DistinctExpr,
473  * and NullIf nodes; be careful to check what xprstate.expr is actually
474  * pointing at!
475  * ----------------
476  */
477 typedef struct FuncExprState
478 {
479         ExprState       xprstate;
480         List       *args;                       /* states of argument expressions */
481
482         /*
483          * Function manager's lookup info for the target function.  If
484          * func.fn_oid is InvalidOid, we haven't initialized it yet.
485          */
486         FmgrInfo        func;
487
488         /*
489          * We also need to store argument values across calls when evaluating
490          * a function-returning-set.
491          *
492          * setArgsValid is true when we are evaluating a set-valued function and
493          * we are in the middle of a call series; we want to pass the same
494          * argument values to the function again (and again, until it returns
495          * ExprEndResult).
496          */
497         bool            setArgsValid;
498
499         /*
500          * Flag to remember whether we found a set-valued argument to the
501          * function. This causes the function result to be a set as well.
502          * Valid only when setArgsValid is true.
503          */
504         bool            setHasSetArg;   /* some argument returns a set */
505
506         /*
507          * Flag to remember whether we have registered a shutdown callback for
508          * this FuncExprState.  We do so only if setArgsValid has been true at
509          * least once (since all the callback is for is to clear
510          * setArgsValid).
511          */
512         bool            shutdown_reg;   /* a shutdown callback is registered */
513
514         /*
515          * Current argument data for a set-valued function; contains valid
516          * data only if setArgsValid is true.
517          */
518         FunctionCallInfoData setArgs;
519 } FuncExprState;
520
521 /* ----------------
522  *              ScalarArrayOpExprState node
523  *
524  * This is a FuncExprState plus some additional data.
525  * ----------------
526  */
527 typedef struct ScalarArrayOpExprState
528 {
529         FuncExprState fxprstate;
530         /* Cached info about array element type */
531         Oid                     element_type;
532         int16           typlen;
533         bool            typbyval;
534         char            typalign;
535 } ScalarArrayOpExprState;
536
537 /* ----------------
538  *              BoolExprState node
539  * ----------------
540  */
541 typedef struct BoolExprState
542 {
543         ExprState       xprstate;
544         List       *args;                       /* states of argument expression(s) */
545 } BoolExprState;
546
547 /* ----------------
548  *              SubPlanState node
549  * ----------------
550  */
551 typedef struct SubPlanState
552 {
553         ExprState       xprstate;
554         EState     *sub_estate;         /* subselect plan has its own EState */
555         struct PlanState *planstate;    /* subselect plan's state tree */
556         List       *exprs;                      /* states of combining expression(s) */
557         List       *args;                       /* states of argument expression(s) */
558         bool            needShutdown;   /* TRUE = need to shutdown subplan */
559         HeapTuple       curTuple;               /* copy of most recent tuple from subplan */
560         /* these are used when hashing the subselect's output: */
561         ProjectionInfo *projLeft;       /* for projecting lefthand exprs */
562         ProjectionInfo *projRight;      /* for projecting subselect output */
563         TupleHashTable hashtable;       /* hash table for no-nulls subselect rows */
564         TupleHashTable hashnulls;       /* hash table for rows with null(s) */
565         bool            havehashrows;   /* TRUE if hashtable is not empty */
566         bool            havenullrows;   /* TRUE if hashnulls is not empty */
567         MemoryContext tablecxt;         /* memory context containing tables */
568         ExprContext *innerecontext; /* working context for comparisons */
569         AttrNumber *keyColIdx;          /* control data for hash tables */
570         FmgrInfo   *eqfunctions;        /* comparison functions for hash tables */
571         FmgrInfo   *hashfunctions;      /* lookup data for hash functions */
572 } SubPlanState;
573
574 /* ----------------
575  *              FieldSelectState node
576  * ----------------
577  */
578 typedef struct FieldSelectState
579 {
580         ExprState       xprstate;
581         ExprState  *arg;                        /* input expression */
582         TupleDesc       argdesc;                /* tupdesc for most recent input */
583 } FieldSelectState;
584
585 /* ----------------
586  *              FieldStoreState node
587  * ----------------
588  */
589 typedef struct FieldStoreState
590 {
591         ExprState       xprstate;
592         ExprState  *arg;                        /* input tuple value */
593         List       *newvals;            /* new value(s) for field(s) */
594         TupleDesc       argdesc;                /* tupdesc for most recent input */
595 } FieldStoreState;
596
597 /* ----------------
598  *              ConvertRowtypeExprState node
599  * ----------------
600  */
601 typedef struct ConvertRowtypeExprState
602 {
603         ExprState       xprstate;
604         ExprState  *arg;                        /* input tuple value */
605         TupleDesc       indesc;                 /* tupdesc for source rowtype */
606         TupleDesc       outdesc;                /* tupdesc for result rowtype */
607         AttrNumber *attrMap;            /* indexes of input fields, or 0 for null */
608         Datum      *invalues;           /* workspace for deconstructing source */
609         bool       *inisnull;
610         Datum      *outvalues;          /* workspace for constructing result */
611         bool       *outisnull;
612 } ConvertRowtypeExprState;
613
614 /* ----------------
615  *              CaseExprState node
616  * ----------------
617  */
618 typedef struct CaseExprState
619 {
620         ExprState       xprstate;
621         ExprState  *arg;                        /* implicit equality comparison argument */
622         List       *args;                       /* the arguments (list of WHEN clauses) */
623         ExprState  *defresult;          /* the default result (ELSE clause) */
624 } CaseExprState;
625
626 /* ----------------
627  *              CaseWhenState node
628  * ----------------
629  */
630 typedef struct CaseWhenState
631 {
632         ExprState       xprstate;
633         ExprState  *expr;                       /* condition expression */
634         ExprState  *result;                     /* substitution result */
635 } CaseWhenState;
636
637 /* ----------------
638  *              ArrayExprState node
639  *
640  * Note: ARRAY[] expressions always produce varlena arrays, never fixed-length
641  * arrays.
642  * ----------------
643  */
644 typedef struct ArrayExprState
645 {
646         ExprState       xprstate;
647         List       *elements;           /* states for child nodes */
648         int16           elemlength;             /* typlen of the array element type */
649         bool            elembyval;              /* is the element type pass-by-value? */
650         char            elemalign;              /* typalign of the element type */
651 } ArrayExprState;
652
653 /* ----------------
654  *              RowExprState node
655  * ----------------
656  */
657 typedef struct RowExprState
658 {
659         ExprState       xprstate;
660         List       *args;                       /* the arguments */
661         TupleDesc       tupdesc;                /* descriptor for result tuples */
662 } RowExprState;
663
664 /* ----------------
665  *              CoalesceExprState node
666  * ----------------
667  */
668 typedef struct CoalesceExprState
669 {
670         ExprState       xprstate;
671         List       *args;                       /* the arguments */
672 } CoalesceExprState;
673
674 /* ----------------
675  *              CoerceToDomainState node
676  * ----------------
677  */
678 typedef struct CoerceToDomainState
679 {
680         ExprState       xprstate;
681         ExprState  *arg;                        /* input expression */
682         /* Cached list of constraints that need to be checked */
683         List       *constraints;        /* list of DomainConstraintState nodes */
684 } CoerceToDomainState;
685
686 /*
687  * DomainConstraintState - one item to check during CoerceToDomain
688  *
689  * Note: this is just a Node, and not an ExprState, because it has no
690  * corresponding Expr to link to.  Nonetheless it is part of an ExprState
691  * tree, so we give it a name following the xxxState convention.
692  */
693 typedef enum DomainConstraintType
694 {
695         DOM_CONSTRAINT_NOTNULL,
696         DOM_CONSTRAINT_CHECK
697 } DomainConstraintType;
698
699 typedef struct DomainConstraintState
700 {
701         NodeTag         type;
702         DomainConstraintType constrainttype;            /* constraint type */
703         char       *name;                       /* name of constraint (for error msgs) */
704         ExprState  *check_expr;         /* for CHECK, a boolean expression */
705 } DomainConstraintState;
706
707
708 /* ----------------------------------------------------------------
709  *                               Executor State Trees
710  *
711  * An executing query has a PlanState tree paralleling the Plan tree
712  * that describes the plan.
713  * ----------------------------------------------------------------
714  */
715
716 /* ----------------
717  *              PlanState node
718  *
719  * We never actually instantiate any PlanState nodes; this is just the common
720  * abstract superclass for all PlanState-type nodes.
721  * ----------------
722  */
723 typedef struct PlanState
724 {
725         NodeTag         type;
726
727         Plan       *plan;                       /* associated Plan node */
728
729         EState     *state;                      /* at execution time, state's of
730                                                                  * individual nodes point to one EState
731                                                                  * for the whole top-level plan */
732
733         struct Instrumentation *instrument; /* Optional runtime stats for this
734                                                                                  * plan node */
735
736         /*
737          * Common structural data for all Plan types.  These links to
738          * subsidiary state trees parallel links in the associated plan tree
739          * (except for the subPlan list, which does not exist in the plan
740          * tree).
741          */
742         List       *targetlist;         /* target list to be computed at this node */
743         List       *qual;                       /* implicitly-ANDed qual conditions */
744         struct PlanState *lefttree; /* input plan tree(s) */
745         struct PlanState *righttree;
746         List       *initPlan;           /* Init SubPlanState nodes (un-correlated
747                                                                  * expr subselects) */
748         List       *subPlan;            /* SubPlanState nodes in my expressions */
749
750         /*
751          * State for management of parameter-change-driven rescanning
752          */
753         Bitmapset  *chgParam;           /* set of IDs of changed Params */
754
755         /*
756          * Other run-time state needed by most if not all node types.
757          */
758         TupleTableSlot *ps_OuterTupleSlot;      /* slot for current "outer" tuple */
759         TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */
760         ExprContext *ps_ExprContext;    /* node's expression-evaluation context */
761         ProjectionInfo *ps_ProjInfo;    /* info for doing tuple projection */
762         bool            ps_TupFromTlist;/* state flag for processing set-valued
763                                                                  * functions in targetlist */
764 } PlanState;
765
766 /* ----------------
767  *      these are are defined to avoid confusion problems with "left"
768  *      and "right" and "inner" and "outer".  The convention is that
769  *      the "left" plan is the "outer" plan and the "right" plan is
770  *      the inner plan, but these make the code more readable.
771  * ----------------
772  */
773 #define innerPlanState(node)            (((PlanState *)(node))->righttree)
774 #define outerPlanState(node)            (((PlanState *)(node))->lefttree)
775
776
777 /* ----------------
778  *       ResultState information
779  * ----------------
780  */
781 typedef struct ResultState
782 {
783         PlanState       ps;                             /* its first field is NodeTag */
784         ExprState  *resconstantqual;
785         bool            rs_done;                /* are we done? */
786         bool            rs_checkqual;   /* do we need to check the qual? */
787 } ResultState;
788
789 /* ----------------
790  *       AppendState information
791  *
792  *              nplans                  how many plans are in the list
793  *              whichplan               which plan is being executed (0 .. n-1)
794  *              firstplan               first plan to execute (usually 0)
795  *              lastplan                last plan to execute (usually n-1)
796  * ----------------
797  */
798 typedef struct AppendState
799 {
800         PlanState       ps;                             /* its first field is NodeTag */
801         PlanState **appendplans;        /* array of PlanStates for my inputs */
802         int                     as_nplans;
803         int                     as_whichplan;
804         int                     as_firstplan;
805         int                     as_lastplan;
806 } AppendState;
807
808 /* ----------------
809  *       BitmapAndState information
810  * ----------------
811  */
812 typedef struct BitmapAndState
813 {
814         PlanState       ps;                             /* its first field is NodeTag */
815         PlanState **bitmapplans;        /* array of PlanStates for my inputs */
816         int                     nplans;                 /* number of input plans */
817 } BitmapAndState;
818
819 /* ----------------
820  *       BitmapOrState information
821  * ----------------
822  */
823 typedef struct BitmapOrState
824 {
825         PlanState       ps;                             /* its first field is NodeTag */
826         PlanState **bitmapplans;        /* array of PlanStates for my inputs */
827         int                     nplans;                 /* number of input plans */
828 } BitmapOrState;
829
830 /* ----------------------------------------------------------------
831  *                               Scan State Information
832  * ----------------------------------------------------------------
833  */
834
835 /* ----------------
836  *       ScanState information
837  *
838  *              ScanState extends PlanState for node types that represent
839  *              scans of an underlying relation.  It can also be used for nodes
840  *              that scan the output of an underlying plan node --- in that case,
841  *              only ScanTupleSlot is actually useful, and it refers to the tuple
842  *              retrieved from the subplan.
843  *
844  *              currentRelation    relation being scanned (NULL if none)
845  *              currentScanDesc    current scan descriptor for scan (NULL if none)
846  *              ScanTupleSlot      pointer to slot in tuple table holding scan tuple
847  * ----------------
848  */
849 typedef struct ScanState
850 {
851         PlanState       ps;                             /* its first field is NodeTag */
852         Relation        ss_currentRelation;
853         HeapScanDesc ss_currentScanDesc;
854         TupleTableSlot *ss_ScanTupleSlot;
855 } ScanState;
856
857 /*
858  * SeqScan uses a bare ScanState as its state node, since it needs
859  * no additional fields.
860  */
861 typedef ScanState SeqScanState;
862
863 /* ----------------
864  *       IndexScanState information
865  *
866  *              indexqualorig      execution state for indexqualorig expressions
867  *              ScanKeys                   Skey structures to scan index rel
868  *              NumScanKeys                number of Skey structs
869  *              RuntimeKeyInfo     array of exprstates for Skeys
870  *                                                 that will be evaluated at runtime
871  *              RuntimeContext     expr context for evaling runtime Skeys
872  *              RuntimeKeysReady   true if runtime Skeys have been computed
873  *              RelationDesc       index relation descriptor
874  *              ScanDesc                   index scan descriptor
875  * ----------------
876  */
877 typedef struct IndexScanState
878 {
879         ScanState       ss;                             /* its first field is NodeTag */
880         List       *indexqualorig;
881         ScanKey         iss_ScanKeys;
882         int                     iss_NumScanKeys;
883         ExprState **iss_RuntimeKeyInfo;
884         ExprContext *iss_RuntimeContext;
885         bool            iss_RuntimeKeysReady;
886         Relation        iss_RelationDesc;
887         IndexScanDesc iss_ScanDesc;
888 } IndexScanState;
889
890 /* ----------------
891  *       BitmapIndexScanState information
892  *
893  *              result                     bitmap to return output into, or NULL
894  *              ScanKeys                   Skey structures to scan index rel
895  *              NumScanKeys                number of Skey structs
896  *              RuntimeKeyInfo     array of exprstates for Skeys
897  *                                                 that will be evaluated at runtime
898  *              RuntimeContext     expr context for evaling runtime Skeys
899  *              RuntimeKeysReady   true if runtime Skeys have been computed
900  *              RelationDesc       index relation descriptor
901  *              ScanDesc                   index scan descriptor
902  * ----------------
903  */
904 typedef struct BitmapIndexScanState
905 {
906         ScanState       ss;                             /* its first field is NodeTag */
907         TIDBitmap  *biss_result;
908         ScanKey         biss_ScanKeys;
909         int                     biss_NumScanKeys;
910         ExprState **biss_RuntimeKeyInfo;
911         ExprContext *biss_RuntimeContext;
912         bool            biss_RuntimeKeysReady;
913         Relation        biss_RelationDesc;
914         IndexScanDesc biss_ScanDesc;
915 } BitmapIndexScanState;
916
917 /* ----------------
918  *       BitmapHeapScanState information
919  *
920  *              bitmapqualorig     execution state for bitmapqualorig expressions
921  *              tbm                                bitmap obtained from child index scan(s)
922  *              tbmres                     current-page data
923  *              curslot                    current tbmres index or tuple offset on page
924  *              minslot                    lowest tbmres index or tuple offset to try
925  *              maxslot                    highest tbmres index or tuple offset to try
926  * ----------------
927  */
928 typedef struct BitmapHeapScanState
929 {
930         ScanState       ss;                             /* its first field is NodeTag */
931         List       *bitmapqualorig;
932         TIDBitmap  *tbm;
933         TBMIterateResult *tbmres;
934         int                     curslot;
935         int                     minslot;
936         int                     maxslot;
937 } BitmapHeapScanState;
938
939 /* ----------------
940  *       TidScanState information
941  *
942  *              NumTids            number of tids in this scan
943  *              TidPtr             current tid in use
944  *              TidList            evaluated item pointers
945  * ----------------
946  */
947 typedef struct TidScanState
948 {
949         ScanState       ss;                             /* its first field is NodeTag */
950         List       *tss_tideval;        /* list of ExprState nodes */
951         int                     tss_NumTids;
952         int                     tss_TidPtr;
953         int                     tss_MarkTidPtr;
954         ItemPointerData *tss_TidList;
955         HeapTupleData tss_htup;
956 } TidScanState;
957
958 /* ----------------
959  *       SubqueryScanState information
960  *
961  *              SubqueryScanState is used for scanning a sub-query in the range table.
962  *              The sub-query will have its own EState, which we save here.
963  *              ScanTupleSlot references the current output tuple of the sub-query.
964  *
965  *              SubEState                  exec state for sub-query
966  * ----------------
967  */
968 typedef struct SubqueryScanState
969 {
970         ScanState       ss;                             /* its first field is NodeTag */
971         PlanState  *subplan;
972         EState     *sss_SubEState;
973 } SubqueryScanState;
974
975 /* ----------------
976  *       FunctionScanState information
977  *
978  *              Function nodes are used to scan the results of a
979  *              function appearing in FROM (typically a function returning set).
980  *
981  *              tupdesc                         expected return tuple description
982  *              tuplestorestate         private state of tuplestore.c
983  *              funcexpr                        state for function expression being evaluated
984  * ----------------
985  */
986 typedef struct FunctionScanState
987 {
988         ScanState       ss;                             /* its first field is NodeTag */
989         TupleDesc       tupdesc;
990         Tuplestorestate *tuplestorestate;
991         ExprState  *funcexpr;
992 } FunctionScanState;
993
994 /* ----------------------------------------------------------------
995  *                               Join State Information
996  * ----------------------------------------------------------------
997  */
998
999 /* ----------------
1000  *       JoinState information
1001  *
1002  *              Superclass for state nodes of join plans.
1003  * ----------------
1004  */
1005 typedef struct JoinState
1006 {
1007         PlanState       ps;
1008         JoinType        jointype;
1009         List       *joinqual;           /* JOIN quals (in addition to ps.qual) */
1010 } JoinState;
1011
1012 /* ----------------
1013  *       NestLoopState information
1014  *
1015  *              NeedNewOuter       true if need new outer tuple on next call
1016  *              MatchedOuter       true if found a join match for current outer tuple
1017  *              NullInnerTupleSlot prepared null tuple for left outer joins
1018  * ----------------
1019  */
1020 typedef struct NestLoopState
1021 {
1022         JoinState       js;                             /* its first field is NodeTag */
1023         bool            nl_NeedNewOuter;
1024         bool            nl_MatchedOuter;
1025         TupleTableSlot *nl_NullInnerTupleSlot;
1026 } NestLoopState;
1027
1028 /* ----------------
1029  *       MergeJoinState information
1030  *
1031  *              NumClauses                 number of mergejoinable join clauses
1032  *              Clauses                    info for each mergejoinable clause
1033  *              JoinState                  current "state" of join.  see execdefs.h
1034  *              FillOuter                  true if should emit unjoined outer tuples anyway
1035  *              FillInner                  true if should emit unjoined inner tuples anyway
1036  *              MatchedOuter       true if found a join match for current outer tuple
1037  *              MatchedInner       true if found a join match for current inner tuple
1038  *              OuterTupleSlot     slot in tuple table for cur outer tuple
1039  *              InnerTupleSlot     slot in tuple table for cur inner tuple
1040  *              MarkedTupleSlot    slot in tuple table for marked tuple
1041  *              NullOuterTupleSlot prepared null tuple for right outer joins
1042  *              NullInnerTupleSlot prepared null tuple for left outer joins
1043  *              OuterEContext      workspace for computing outer tuple's join values
1044  *              InnerEContext      workspace for computing inner tuple's join values
1045  * ----------------
1046  */
1047 /* private in nodeMergejoin.c: */
1048 typedef struct MergeJoinClauseData *MergeJoinClause;
1049
1050 typedef struct MergeJoinState
1051 {
1052         JoinState       js;                             /* its first field is NodeTag */
1053         int                     mj_NumClauses;
1054         MergeJoinClause mj_Clauses;     /* array of length mj_NumClauses */
1055         int                     mj_JoinState;
1056         bool            mj_FillOuter;
1057         bool            mj_FillInner;
1058         bool            mj_MatchedOuter;
1059         bool            mj_MatchedInner;
1060         TupleTableSlot *mj_OuterTupleSlot;
1061         TupleTableSlot *mj_InnerTupleSlot;
1062         TupleTableSlot *mj_MarkedTupleSlot;
1063         TupleTableSlot *mj_NullOuterTupleSlot;
1064         TupleTableSlot *mj_NullInnerTupleSlot;
1065         ExprContext *mj_OuterEContext;
1066         ExprContext *mj_InnerEContext;
1067 } MergeJoinState;
1068
1069 /* ----------------
1070  *       HashJoinState information
1071  *
1072  *              hj_HashTable                    hash table for the hashjoin
1073  *                                                              (NULL if table not built yet)
1074  *              hj_CurHashValue                 hash value for current outer tuple
1075  *              hj_CurBucketNo                  bucket# for current outer tuple
1076  *              hj_CurTuple                             last inner tuple matched to current outer
1077  *                                                              tuple, or NULL if starting search
1078  *                                                              (CurHashValue, CurBucketNo and CurTuple are
1079  *                                                               undefined if OuterTupleSlot is empty!)
1080  *              hj_OuterHashKeys                the outer hash keys in the hashjoin condition
1081  *              hj_InnerHashKeys                the inner hash keys in the hashjoin condition
1082  *              hj_HashOperators                the join operators in the hashjoin condition
1083  *              hj_OuterTupleSlot               tuple slot for outer tuples
1084  *              hj_HashTupleSlot                tuple slot for hashed tuples
1085  *              hj_NullInnerTupleSlot   prepared null tuple for left outer joins
1086  *              hj_NeedNewOuter                 true if need new outer tuple on next call
1087  *              hj_MatchedOuter                 true if found a join match for current outer
1088  * ----------------
1089  */
1090
1091 /* these structs are defined in executor/hashjoin.h: */
1092 typedef struct HashJoinTupleData *HashJoinTuple;
1093 typedef struct HashJoinTableData *HashJoinTable;
1094
1095 typedef struct HashJoinState
1096 {
1097         JoinState       js;                             /* its first field is NodeTag */
1098         List       *hashclauses;        /* list of ExprState nodes */
1099         HashJoinTable hj_HashTable;
1100         uint32          hj_CurHashValue;
1101         int                     hj_CurBucketNo;
1102         HashJoinTuple hj_CurTuple;
1103         List       *hj_OuterHashKeys;           /* list of ExprState nodes */
1104         List       *hj_InnerHashKeys;           /* list of ExprState nodes */
1105         List       *hj_HashOperators;           /* list of operator OIDs */
1106         TupleTableSlot *hj_OuterTupleSlot;
1107         TupleTableSlot *hj_HashTupleSlot;
1108         TupleTableSlot *hj_NullInnerTupleSlot;
1109         bool            hj_NeedNewOuter;
1110         bool            hj_MatchedOuter;
1111 } HashJoinState;
1112
1113
1114 /* ----------------------------------------------------------------
1115  *                               Materialization State Information
1116  * ----------------------------------------------------------------
1117  */
1118
1119 /* ----------------
1120  *       MaterialState information
1121  *
1122  *              materialize nodes are used to materialize the results
1123  *              of a subplan into a temporary file.
1124  *
1125  *              ss.ss_ScanTupleSlot refers to output of underlying plan.
1126  * ----------------
1127  */
1128 typedef struct MaterialState
1129 {
1130         ScanState       ss;                             /* its first field is NodeTag */
1131         void       *tuplestorestate;    /* private state of tuplestore.c */
1132         bool            eof_underlying; /* reached end of underlying plan? */
1133 } MaterialState;
1134
1135 /* ----------------
1136  *       SortState information
1137  * ----------------
1138  */
1139 typedef struct SortState
1140 {
1141         ScanState       ss;                             /* its first field is NodeTag */
1142         bool            sort_Done;              /* sort completed yet? */
1143         void       *tuplesortstate; /* private state of tuplesort.c */
1144 } SortState;
1145
1146 /* ---------------------
1147  *      GroupState information
1148  * -------------------------
1149  */
1150 typedef struct GroupState
1151 {
1152         ScanState       ss;                             /* its first field is NodeTag */
1153         FmgrInfo   *eqfunctions;        /* per-field lookup data for equality fns */
1154         bool            grp_done;               /* indicates completion of Group scan */
1155 } GroupState;
1156
1157 /* ---------------------
1158  *      AggState information
1159  *
1160  *      ss.ss_ScanTupleSlot refers to output of underlying plan.
1161  *
1162  *      Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and
1163  *      ecxt_aggnulls arrays, which hold the computed agg values for the current
1164  *      input group during evaluation of an Agg node's output tuple(s).  We
1165  *      create a second ExprContext, tmpcontext, in which to evaluate input
1166  *      expressions and run the aggregate transition functions.
1167  * -------------------------
1168  */
1169 /* these structs are private in nodeAgg.c: */
1170 typedef struct AggStatePerAggData *AggStatePerAgg;
1171 typedef struct AggStatePerGroupData *AggStatePerGroup;
1172
1173 typedef struct AggState
1174 {
1175         ScanState       ss;                             /* its first field is NodeTag */
1176         List       *aggs;                       /* all Aggref nodes in targetlist & quals */
1177         int                     numaggs;                /* length of list (could be zero!) */
1178         FmgrInfo   *eqfunctions;        /* per-grouping-field equality fns */
1179         FmgrInfo   *hashfunctions;      /* per-grouping-field hash fns */
1180         AggStatePerAgg peragg;          /* per-Aggref information */
1181         MemoryContext aggcontext;       /* memory context for long-lived data */
1182         ExprContext *tmpcontext;        /* econtext for input expressions */
1183         bool            agg_done;               /* indicates completion of Agg scan */
1184         /* these fields are used in AGG_PLAIN and AGG_SORTED modes: */
1185         AggStatePerGroup pergroup;      /* per-Aggref-per-group working state */
1186         HeapTuple       grp_firstTuple; /* copy of first tuple of current group */
1187         /* these fields are used in AGG_HASHED mode: */
1188         TupleHashTable hashtable;       /* hash table with one entry per group */
1189         bool            table_filled;   /* hash table filled yet? */
1190         TupleHashIterator hashiter; /* for iterating through hash table */
1191 } AggState;
1192
1193 /* ----------------
1194  *       UniqueState information
1195  *
1196  *              Unique nodes are used "on top of" sort nodes to discard
1197  *              duplicate tuples returned from the sort phase.  Basically
1198  *              all it does is compare the current tuple from the subplan
1199  *              with the previously fetched tuple (stored in its result slot).
1200  *              If the two are identical in all interesting fields, then
1201  *              we just fetch another tuple from the sort and try again.
1202  * ----------------
1203  */
1204 typedef struct UniqueState
1205 {
1206         PlanState       ps;                             /* its first field is NodeTag */
1207         FmgrInfo   *eqfunctions;        /* per-field lookup data for equality fns */
1208         MemoryContext tempContext;      /* short-term context for comparisons */
1209 } UniqueState;
1210
1211 /* ----------------
1212  *       HashState information
1213  * ----------------
1214  */
1215 typedef struct HashState
1216 {
1217         PlanState       ps;                             /* its first field is NodeTag */
1218         HashJoinTable hashtable;        /* hash table for the hashjoin */
1219         List       *hashkeys;           /* list of ExprState nodes */
1220         /* hashkeys is same as parent's hj_InnerHashKeys */
1221         TupleTableSlot *firstTuple;     /* tuple produced by ExecHash() */
1222 } HashState;
1223
1224 /* ----------------
1225  *       SetOpState information
1226  *
1227  *              SetOp nodes are used "on top of" sort nodes to discard
1228  *              duplicate tuples returned from the sort phase.  These are
1229  *              more complex than a simple Unique since we have to count
1230  *              how many duplicates to return.
1231  * ----------------
1232  */
1233 typedef struct SetOpState
1234 {
1235         PlanState       ps;                             /* its first field is NodeTag */
1236         FmgrInfo   *eqfunctions;        /* per-field lookup data for equality fns */
1237         bool            subplan_done;   /* has subplan returned EOF? */
1238         long            numLeft;                /* number of left-input dups of cur group */
1239         long            numRight;               /* number of right-input dups of cur group */
1240         long            numOutput;              /* number of dups left to output */
1241         MemoryContext tempContext;      /* short-term context for comparisons */
1242 } SetOpState;
1243
1244 /* ----------------
1245  *       LimitState information
1246  *
1247  *              Limit nodes are used to enforce LIMIT/OFFSET clauses.
1248  *              They just select the desired subrange of their subplan's output.
1249  *
1250  * offset is the number of initial tuples to skip (0 does nothing).
1251  * count is the number of tuples to return after skipping the offset tuples.
1252  * If no limit count was specified, count is undefined and noCount is true.
1253  * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet.
1254  * ----------------
1255  */
1256 typedef enum
1257 {
1258         LIMIT_INITIAL,                          /* initial state for LIMIT node */
1259         LIMIT_EMPTY,                            /* there are no returnable rows */
1260         LIMIT_INWINDOW,                         /* have returned a row in the window */
1261         LIMIT_SUBPLANEOF,                       /* at EOF of subplan (within window) */
1262         LIMIT_WINDOWEND,                        /* stepped off end of window */
1263         LIMIT_WINDOWSTART                       /* stepped off beginning of window */
1264 } LimitStateCond;
1265
1266 typedef struct LimitState
1267 {
1268         PlanState       ps;                             /* its first field is NodeTag */
1269         ExprState  *limitOffset;        /* OFFSET parameter, or NULL if none */
1270         ExprState  *limitCount;         /* COUNT parameter, or NULL if none */
1271         long            offset;                 /* current OFFSET value */
1272         long            count;                  /* current COUNT, if any */
1273         bool            noCount;                /* if true, ignore count */
1274         LimitStateCond lstate;          /* state machine status, as above */
1275         long            position;               /* 1-based index of last tuple returned */
1276         TupleTableSlot *subSlot;        /* tuple last obtained from subplan */
1277 } LimitState;
1278
1279 #endif   /* EXECNODES_H */