]> granicus.if.org Git - postgresql/blob - src/include/nodes/execnodes.h
New SubPlan node for subselects.
[postgresql] / src / include / nodes / execnodes.h
1 /*-------------------------------------------------------------------------
2  *
3  * execnodes.h--
4  *        definitions for executor state nodes
5  *
6  *
7  * Copyright (c) 1994, Regents of the University of California
8  *
9  * $Id: execnodes.h,v 1.13 1998/02/13 03:45:22 vadim Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef EXECNODES_H
14 #define EXECNODES_H
15
16 #include <nodes/memnodes.h>
17 #include <nodes/primnodes.h>
18 #include <executor/hashjoin.h>
19 #include <access/relscan.h>
20 #include <access/sdir.h>
21 #include <nodes/params.h>
22 #include <executor/tuptable.h>
23 #include <access/funcindex.h>
24
25 /* ----------------
26  *        IndexInfo information
27  *
28  *              this class holds the information saying what attributes
29  *              are the key attributes for this index. -cim 10/15/89
30  *
31  *              NumKeyAttributes                number of key attributes for this index
32  *              KeyAttributeNumbers             array of attribute numbers used as keys
33  *              Predicate                               partial-index predicate for this index
34  * ----------------
35  */
36 typedef struct IndexInfo
37 {
38         NodeTag         type;
39         int                     ii_NumKeyAttributes;
40         AttrNumber *ii_KeyAttributeNumbers;
41         FuncIndexInfoPtr ii_FuncIndexInfo;
42         Node       *ii_Predicate;
43 } IndexInfo;
44
45 /* ----------------
46  *        RelationInfo information
47  *
48  *              whenever we update an existing relation, we have to
49  *              update indices on the relation.  The RelationInfo class
50  *              is used to hold all the information on result relations,
51  *              including indices.. -cim 10/15/89
52  *
53  *              RangeTableIndex                 result relation's range table index
54  *              RelationDesc                    relation descriptor for result relation
55  *              NumIndices                              number indices existing on result relation
56  *              IndexRelationDescs              array of relation descriptors for indices
57  *              IndexRelationInfo               array of key/attr info for indices
58  * ----------------
59  */
60 typedef struct RelationInfo
61 {
62         NodeTag         type;
63         Index           ri_RangeTableIndex;
64         Relation        ri_RelationDesc;
65         int                     ri_NumIndices;
66         RelationPtr ri_IndexRelationDescs;
67         IndexInfo **ri_IndexRelationInfo;
68 } RelationInfo;
69
70 /* ----------------
71  *        ExprContext
72  *
73  *              This class holds the "current context" information
74  *              needed to evaluate expressions for doing tuple qualifications
75  *              and tuple projections.  For example, if an expression refers
76  *              to an attribute in the current inner tuple then we need to know
77  *              what the current inner tuple is and so we look at the expression
78  *              context.
79  * ----------------
80  */
81 typedef struct ExprContext
82 {
83         NodeTag                         type;
84         TupleTableSlot     *ecxt_scantuple;
85         TupleTableSlot     *ecxt_innertuple;
86         TupleTableSlot     *ecxt_outertuple;
87         Relation                        ecxt_relation;
88         Index                           ecxt_relid;
89         ParamListInfo           ecxt_param_list_info;
90         ParamExecData      *ecxt_param_exec_vals;       /* this is for subselects */
91         List                       *ecxt_range_table;
92         Datum                      *ecxt_values;        /* precomputed values for aggreg */
93         char                       *ecxt_nulls;         /* null flags for aggreg  values */
94 } ExprContext;
95
96 /* ----------------
97  *              ProjectionInfo node information
98  *
99  *              This is all the information needed to preform projections
100  *              on a tuple.  Nodes which need to do projections create one
101  *              of these.  In theory, when a node wants to preform a projection
102  *              it should just update this information as necessary and then
103  *              call ExecProject().  -cim 6/3/91
104  *
105  *              targetlist              target list for projection
106  *              len                             length of target list
107  *              tupValue                array of pointers to projection results
108  *              exprContext             expression context for ExecTargetList
109  *              slot                    slot to place projection result in
110  * ----------------
111  */
112 typedef struct ProjectionInfo
113 {
114         NodeTag         type;
115         List       *pi_targetlist;
116         int                     pi_len;
117         Datum      *pi_tupValue;
118         ExprContext *pi_exprContext;
119         TupleTableSlot *pi_slot;
120 } ProjectionInfo;
121
122 /* ----------------
123  *        JunkFilter
124  *
125  *        this class is used to store information regarding junk attributes.
126  *        A junk attribute is an attribute in a tuple that is needed only for
127  *        storing intermediate information in the executor, and does not belong
128  *        in the tuple proper.  For example, when we do a delete or replace
129  *        query, the planner adds an entry to the targetlist so that the tuples
130  *        returned to ExecutePlan() contain an extra attribute: the t_ctid of
131  *        the tuple to be deleted/replaced.  This is needed for amdelete() and
132  *        amreplace().  In doing a delete this does not make much of a
133  *        difference, but in doing a replace we have to make sure we disgard
134  *        all the junk in a tuple before calling amreplace().  Otherwise the
135  *        inserted tuple will not have the correct schema.      This solves a
136  *        problem with hash-join and merge-sort replace plans.  -cim 10/10/90
137  *
138  *        targetList:           the original target list (including junk attributes).
139  *        length:                       the length of 'targetList'.
140  *        tupType:                      the tuple descriptor for the "original" tuple
141  *                                              (including the junk attributes).
142  *        cleanTargetList:      the "clean" target list (junk attributes removed).
143  *        cleanLength:          the length of 'cleanTargetList'
144  *        cleanTupTyp:          the tuple descriptor of the "clean" tuple (with
145  *                                              junk attributes removed).
146  *        cleanMap:                     A map with the correspondance between the non junk
147  *                                              attributes of the "original" tuple and the
148  *                                              attributes of the "clean" tuple.
149  * ----------------
150  */
151 typedef struct JunkFilter
152 {
153         NodeTag         type;
154         List       *jf_targetList;
155         int                     jf_length;
156         TupleDesc       jf_tupType;
157         List       *jf_cleanTargetList;
158         int                     jf_cleanLength;
159         TupleDesc       jf_cleanTupType;
160         AttrNumber *jf_cleanMap;
161 } JunkFilter;
162
163 /* ----------------
164  *        EState information
165  *
166  *              direction                                               direction of the scan
167  *
168  *              range_table                                             array of scan relation information
169  *
170  *              result_relation_information             for update queries
171  *
172  *              into_relation_descriptor                relation being retrieved "into"
173  *
174  *              param_list_info                                 information needed to transform
175  *                                                                              Param nodes into Const nodes
176  *
177  *              BaseId                                                  during InitPlan(), each node is
178  *                                                                              given a number.  this is the next
179  *                                                                              number to be assigned.
180  *
181  *              tupleTable                                              this is a pointer to an array
182  *                                                                              of pointers to tuples used by
183  *                                                                              the executor at any given moment.
184  *
185  *              junkFilter                                              contains information used to
186  *                                                                              extract junk attributes from a tuple.
187  *                                                                              (see JunkFilter above)
188  *
189  *              refcount                                                local buffer refcounts used in
190  *                                                                              an ExecMain cycle.      this is introduced
191  *                                                                              to avoid ExecStart's unpinning each
192  *                                                                              other's buffers when called recursively
193  * ----------------
194  */
195 typedef struct EState
196 {
197         NodeTag                         type;
198         ScanDirection           es_direction;
199         List                       *es_range_table;
200         RelationInfo       *es_result_relation_info;
201         Relation                        es_into_relation_descriptor;
202         ParamListInfo           es_param_list_info;
203         ParamExecData      *es_param_exec_vals; /* this is for subselects */
204         int                                     es_BaseId;
205         TupleTable                      es_tupleTable;
206         JunkFilter                 *es_junkFilter;
207         int                                *es_refcount;
208         uint32                          es_processed;   /* # of tuples processed */
209         Oid                                     es_lastoid;             /* last oid processed (by INSERT) */
210 } EState;
211
212 /* ----------------
213  *              Executor Type information needed by plannodes.h
214  *
215  *|             Note: the bogus classes CommonState and CommonScanState exist only
216  *|                       because our inheritance system only allows single inheritance
217  *|                       and we have to have unique slot names.  Hence two or more
218  *|                       classes which want to have a common slot must ALL inherit
219  *|                       the slot from some other class.  (This is a big hack to
220  *|                       allow our classes to share slot names..)
221  *|
222  *|             Example:
223  *|                       the class Result and the class NestLoop nodes both want
224  *|                       a slot called "OuterTuple" so they both have to inherit
225  *|                       it from some other class.  In this case they inherit
226  *|                       it from CommonState.  "CommonState" and "CommonScanState" are
227  *|                       the best names I could come up with for this sort of
228  *|                       stuff.
229  *|
230  *|                       As a result, many classes have extra slots which they
231  *|                       don't use.  These slots are denoted (unused) in the
232  *|                       comment preceeding the class definition.      If you
233  *|                       comes up with a better idea of a way of doing things
234  *|                       along these lines, then feel free to make your idea
235  *|                       known to me.. -cim 10/15/89
236  * ----------------
237  */
238
239 /* ----------------------------------------------------------------
240  *                               Common Executor State Information
241  * ----------------------------------------------------------------
242  */
243
244 /* BaseNode removed -- base_id moved into CommonState           - jolly */
245
246 /* ----------------
247  *       CommonState information
248  *
249  *|             this is a bogus class used to hold slots so other
250  *|             nodes can inherit them...
251  *
252  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
253  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
254  *              ExprContext                node's current expression context
255  *              ProjInfo                   info this node uses to form tuple projections
256  *              NumScanAttributes  size of ScanAttributes array
257  *              ScanAttributes     attribute numbers of interest in this tuple
258  *
259  * ----------------
260  */
261 typedef struct CommonState
262 {
263         NodeTag         type;                   /* its first field is NodeTag */
264         int                     cs_base_id;
265         TupleTableSlot *cs_OuterTupleSlot;
266         TupleTableSlot *cs_ResultTupleSlot;
267         ExprContext *cs_ExprContext;
268         ProjectionInfo *cs_ProjInfo;
269         bool            cs_TupFromTlist;
270 } CommonState;
271
272
273 /* ----------------------------------------------------------------
274  *                               Control Node State Information
275  * ----------------------------------------------------------------
276  */
277
278 /* ----------------
279  *       ResultState information
280  *
281  *              done                       flag which tells us to quit when we
282  *                                                 have already returned a constant tuple.
283  *
284  *       CommonState information
285  *
286  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
287  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
288  *              ExprContext                node's current expression context
289  *              ProjInfo                   info this node uses to form tuple projections
290  *              NumScanAttributes  size of ScanAttributes array
291  *              ScanAttributes     attribute numbers of interest in this tuple
292  * ----------------
293  */
294 typedef struct ResultState
295 {
296         CommonState cstate;                     /* its first field is NodeTag */
297         bool            rs_done;
298         bool            rs_checkqual;
299 } ResultState;
300
301 /* ----------------
302  *       AppendState information
303  *
304  *              append nodes have this field "unionplans" which is this
305  *              list of plans to execute in sequence..  these variables
306  *              keep track of things..
307  *
308  *              whichplan               which plan is being executed
309  *              nplans                  how many plans are in the list
310  *              initialized             array of ExecInitNode() results
311  *              rtentries               range table for the current plan
312  *              result_relation_info_list  array of each subplan's result relation info
313  *              junkFilter_list  array of each subplan's junk filter
314  *
315  *       CommonState information
316  *
317  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
318  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
319  *              ExprContext                node's current expression context
320  *              ProjInfo                   info this node uses to form tuple projections
321  *              NumScanAttributes  size of ScanAttributes array
322  *              ScanAttributes     attribute numbers of interest in this tuple
323  * ----------------
324  */
325 typedef struct AppendState
326 {
327         CommonState cstate;                     /* its first field is NodeTag */
328         int                     as_whichplan;
329         int                     as_nplans;
330         bool       *as_initialized;
331         List       *as_rtentries;
332         List       *as_result_relation_info_list;
333         List       *as_junkFilter_list;
334 } AppendState;
335
336 /* ----------------------------------------------------------------
337  *                               Scan State Information
338  * ----------------------------------------------------------------
339  */
340
341 /* ----------------
342  *       CommonScanState information
343  *
344  *              CommonScanState is a class like CommonState, but is used more
345  *              by the nodes like SeqScan and Sort which want to
346  *              keep track of an underlying relation.
347  *
348  *              currentRelation    relation being scanned
349  *              currentScanDesc    current scan descriptor for scan
350  *              ScanTupleSlot      pointer to slot in tuple table holding scan tuple
351  *
352  *       CommonState information
353  *
354  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
355  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
356  *              ExprContext                node's current expression context
357  *              ProjInfo                   info this node uses to form tuple projections
358  *              NumScanAttributes  size of ScanAttributes array
359  *              ScanAttributes     attribute numbers of interest in this tuple
360  * ----------------
361  */
362 typedef struct CommonScanState
363 {
364         CommonState cstate;                     /* its first field is NodeTag */
365         Relation        css_currentRelation;
366         HeapScanDesc css_currentScanDesc;
367         TupleTableSlot *css_ScanTupleSlot;
368 } CommonScanState;
369
370 /* ----------------
371  *       IndexScanState information
372  *
373  *|             index scans don't use CommonScanState because
374  *|             the underlying AM abstractions for heap scans and
375  *|             index scans are too different..  It would be nice
376  *|             if the current abstraction was more useful but ... -cim 10/15/89
377  *
378  *              IndexPtr                   current index in use
379  *              NumIndices                 number of indices in this scan
380  *              ScanKeys                   Skey structures to scan index rels
381  *              NumScanKeys                array of no of keys in each Skey struct
382  *              RuntimeKeyInfo     array of array of flags for Skeys evaled at runtime
383  *              RelationDescs      ptr to array of relation descriptors
384  *              ScanDescs                  ptr to array of scan descriptors
385  *
386  *       CommonState information
387  *
388  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
389  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
390  *              ExprContext                node's current expression context
391  *              ProjInfo                   info this node uses to form tuple projections
392  *              NumScanAttributes  size of ScanAttributes array
393  *              ScanAttributes     attribute numbers of interest in this tuple
394  * ----------------
395  */
396 typedef struct IndexScanState
397 {
398         CommonState cstate;                     /* its first field is NodeTag */
399         int                     iss_NumIndices;
400         int                     iss_IndexPtr;
401         ScanKey    *iss_ScanKeys;
402         int                *iss_NumScanKeys;
403         Pointer         iss_RuntimeKeyInfo;
404         RelationPtr iss_RelationDescs;
405         IndexScanDescPtr iss_ScanDescs;
406 } IndexScanState;
407
408
409 /* ----------------------------------------------------------------
410  *                               Join State Information
411  * ----------------------------------------------------------------
412  */
413
414 /* ----------------
415  *       JoinState information
416  *
417  *       CommonState information
418  *
419  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
420  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
421  *              ExprContext                node's current expression context
422  *              ProjInfo                   info this node uses to form tuple projections
423  *              NumScanAttributes  size of ScanAttributes array
424  *              ScanAttributes     attribute numbers of interest in this tuple
425  * ----------------
426  */
427 typedef CommonState JoinState;
428
429 /* ----------------
430  *       NestLoopState information
431  *
432  *              PortalFlag                 Set to enable portals to work.
433  *
434  *       JoinState information
435  *
436  *       CommonState information
437  *
438  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
439  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
440  *              ExprContext                node's current expression context
441  *              ProjInfo                   info this node uses to form tuple projections
442  *              NumScanAttributes  size of ScanAttributes array
443  *              ScanAttributes     attribute numbers of interest in this tuple
444  * ----------------
445  */
446 typedef struct NestLoopState
447 {
448         JoinState       jstate;                 /* its first field is NodeTag */
449         bool            nl_PortalFlag;
450 } NestLoopState;
451
452 /* ----------------
453  *       MergeJoinState information
454  *
455  *              OSortopI                   outerKey1 sortOp innerKey1 ...
456  *              ISortopO                   innerkey1 sortOp outerkey1 ...
457  *              JoinState                  current "state" of join. see executor.h
458  *              MarkedTupleSlot    pointer to slot in tuple table for marked tuple
459  *
460  *       JoinState information
461  *
462  *       CommonState information
463  *
464  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
465  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
466  *              ExprContext                node's current expression context
467  *              ProjInfo                   info this node uses to form tuple projections
468  *              NumScanAttributes  size of ScanAttributes array
469  *              ScanAttributes     attribute numbers of interest in this tuple
470  * ----------------
471  */
472 typedef struct MergeJoinState
473 {
474         JoinState       jstate;                 /* its first field is NodeTag */
475         List       *mj_OSortopI;
476         List       *mj_ISortopO;
477         int                     mj_JoinState;
478         TupleTableSlot *mj_MarkedTupleSlot;
479 } MergeJoinState;
480
481 /* ----------------
482  *       HashJoinState information
483  *
484  *              hj_HashTable                    address of the hash table for the hashjoin
485  *              hj_HashTableShmId               shared memory id of hash table
486  *              hj_CurBucket                    the current hash bucket that we are searching
487  *                                                              for matches of the current outer tuple
488  *              hj_CurTuple                             the current matching inner tuple in the
489  *                                                              current hash bucket
490  *              hj_CurOTuple                    the current matching inner tuple in the
491  *                                                              current hash overflow chain
492  *              hj_InnerHashKey                 the inner hash key in the hashjoin condition
493  *              hj_OuterBatches                 file descriptors for outer batches
494  *              hj_InnerBatches                 file descriptors for inner batches
495  *              hj_OuterReadPos                 current read position of outer batch
496  *              hj_OuterReadBlk                 current read block of outer batch
497  *              hj_OuterTupleSlot               tuple slot for outer tuples
498  *              hj_HashTupleSlot                tuple slot for hashed tuples
499  *
500  *
501  *
502  *       JoinState information
503  *
504  *       CommonState information
505  *
506  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
507  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
508  *              ExprContext                node's current expression context
509  *              ProjInfo                   info this node uses to form tuple projections
510  *              NumScanAttributes  size of ScanAttributes array
511  *              ScanAttributes     attribute numbers of interest in this tuple
512  * ----------------
513  */
514 typedef struct HashJoinState
515 {
516         JoinState       jstate;                 /* its first field is NodeTag */
517         HashJoinTable hj_HashTable;
518         IpcMemoryId hj_HashTableShmId;
519         HashBucket      hj_CurBucket;
520         HeapTuple       hj_CurTuple;
521         OverflowTuple hj_CurOTuple;
522         Var                *hj_InnerHashKey;
523         File       *hj_OuterBatches;
524         File       *hj_InnerBatches;
525         char       *hj_OuterReadPos;
526         int                     hj_OuterReadBlk;
527         TupleTableSlot *hj_OuterTupleSlot;
528         TupleTableSlot *hj_HashTupleSlot;
529 } HashJoinState;
530
531
532 /* ----------------------------------------------------------------
533  *                               Materialization State Information
534  * ----------------------------------------------------------------
535  */
536
537 /* ----------------
538  *       MaterialState information
539  *
540  *              materialize nodes are used to materialize the results
541  *              of a subplan into a temporary relation.
542  *
543  *              Flag                    indicated whether subplan has been materialized
544  *              TempRelation    temporary relation containing result of executing
545  *                                              the subplan.
546  *
547  *       CommonScanState information
548  *
549  *              currentRelation    relation descriptor of sorted relation
550  *              currentScanDesc    current scan descriptor for scan
551  *              ScanTupleSlot      pointer to slot in tuple table holding scan tuple
552  *
553  *       CommonState information
554  *
555  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
556  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
557  *              ExprContext                node's current expression context
558  *              ProjInfo                   info this node uses to form tuple projections
559  *              NumScanAttributes  size of ScanAttributes array
560  *              ScanAttributes     attribute numbers of interest in this tuple
561  * ----------------
562  */
563 typedef struct MaterialState
564 {
565         CommonScanState csstate;        /* its first field is NodeTag */
566         bool            mat_Flag;
567         Relation        mat_TempRelation;
568 } MaterialState;
569
570 /* ---------------------
571  *      AggregateState information
572  *
573  *              done                    indicated whether aggregate has been materialized
574  * -------------------------
575  */
576 typedef struct AggState
577 {
578         CommonScanState csstate;        /* its first field is NodeTag */
579         bool            agg_done;
580 } AggState;
581
582 /* ---------------------
583  *      GroupState information
584  *
585  * -------------------------
586  */
587 typedef struct GroupState
588 {
589         CommonScanState csstate;        /* its first field is NodeTag */
590         bool            grp_useLastTuple;               /* last tuple not processed yet */
591         bool            grp_done;
592         TupleTableSlot *grp_lastSlot;
593 } GroupState;
594
595 /* ----------------
596  *       SortState information
597  *
598  *|             sort nodes are really just a kind of a scan since
599  *|             we implement sorts by retrieveing the entire subplan
600  *|             into a temp relation, sorting the temp relation into
601  *|             another sorted relation, and then preforming a simple
602  *|             unqualified sequential scan on the sorted relation..
603  *|             -cim 10/15/89
604  *
605  *              Flag                    indicated whether relation has been sorted
606  *              Keys                    scan key structures used to keep info on sort keys
607  *              TempRelation    temporary relation containing result of executing
608  *                                              the subplan.
609  *
610  *       CommonScanState information
611  *
612  *              currentRelation    relation descriptor of sorted relation
613  *              currentScanDesc    current scan descriptor for scan
614  *              ScanTupleSlot      pointer to slot in tuple table holding scan tuple
615  *
616  *       CommonState information
617  *
618  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
619  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
620  *              ExprContext                node's current expression context
621  *              ProjInfo                   info this node uses to form tuple projections
622  *              NumScanAttributes  size of ScanAttributes array
623  *              ScanAttributes     attribute numbers of interest in this tuple
624  * ----------------
625  */
626 typedef struct SortState
627 {
628         CommonScanState csstate;        /* its first field is NodeTag */
629         bool            sort_Flag;
630         ScanKey         sort_Keys;
631         bool            cleaned;
632 } SortState;
633
634 /* ----------------
635  *       UniqueState information
636  *
637  *              Unique nodes are used "on top of" sort nodes to discard
638  *              duplicate tuples returned from the sort phase.  Basically
639  *              all it does is compare the current tuple from the subplan
640  *              with the previously fetched tuple stored in OuterTuple and
641  *              if the two are identical, then we just fetch another tuple
642  *              from the sort and try again.
643  *
644  *       CommonState information
645  *
646  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
647  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
648  *              ExprContext                node's current expression context
649  *              ProjInfo                   info this node uses to form tuple projections
650  *              NumScanAttributes  size of ScanAttributes array
651  *              ScanAttributes     attribute numbers of interest in this tuple
652  * ----------------
653  */
654 typedef CommonState UniqueState;
655
656
657 /* ----------------
658  *       HashState information
659  *
660  *              hashBatches                file descriptors for the batches
661  *
662  *       CommonState information
663  *
664  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
665  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
666  *              ExprContext                node's current expression context
667  *              ProjInfo                   info this node uses to form tuple projections
668  *              NumScanAttributes  size of ScanAttributes array
669  *              ScanAttributes     attribute numbers of interest in this tuple
670  * ----------------
671  */
672 typedef struct HashState
673 {
674         CommonState cstate;                     /* its first field is NodeTag */
675         File       *hashBatches;
676 } HashState;
677
678 /* -----------------------
679  *      TeeState information
680  *        leftPlace  :    next item in the queue unseen by the left parent
681  *        rightPlace :    next item in the queue unseen by the right parent
682  *        lastPlace  :    last item in the queue
683  *        bufferRelname :  name of the relation used as the buffer queue
684  *        bufferRel             :  the relation used as the buffer queue
685  *        mcxt                  :  for now, tee's have their own memory context
686  *                                         may be cleaned up later if portals are cleaned up
687  *
688  * initially, a Tee starts with [left/right]Place variables set to      -1.
689  * on cleanup, queue is free'd when both leftPlace and rightPlace = -1
690  * -------------------------
691 */
692 typedef struct TeeState
693 {
694         CommonState cstate;                     /* its first field is NodeTag */
695         int                     tee_leftPlace;
696         int                     tee_rightPlace;
697         int                     tee_lastPlace;
698         char       *tee_bufferRelname;
699         Relation        tee_bufferRel;
700         MemoryContext tee_mcxt;
701         HeapScanDesc tee_leftScanDesc;
702         HeapScanDesc tee_rightScanDesc;
703 } TeeState;
704
705 #endif                                                  /* EXECNODES_H */