]> granicus.if.org Git - postgresql/blob - src/include/nodes/execnodes.h
SELECT FOR UPDATE is implemented...
[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.21 1999/01/25 12:01:19 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         Snapshot        es_snapshot;
200         List       *es_range_table;
201         RelationInfo *es_result_relation_info;
202         Relation        es_into_relation_descriptor;
203         ParamListInfo es_param_list_info;
204         ParamExecData *es_param_exec_vals;      /* this is for subselects */
205         int                     es_BaseId;
206         TupleTable      es_tupleTable;
207         JunkFilter *es_junkFilter;
208         int                *es_refcount;
209         uint32          es_processed;   /* # of tuples processed */
210         Oid                     es_lastoid;             /* last oid processed (by INSERT) */
211         List       *es_rowMark;         /* not good place, but there is no other */
212 } EState;
213
214 /* ----------------
215  *              Executor Type information needed by plannodes.h
216  *
217  *|             Note: the bogus classes CommonState and CommonScanState exist only
218  *|                       because our inheritance system only allows single inheritance
219  *|                       and we have to have unique slot names.  Hence two or more
220  *|                       classes which want to have a common slot must ALL inherit
221  *|                       the slot from some other class.  (This is a big hack to
222  *|                       allow our classes to share slot names..)
223  *|
224  *|             Example:
225  *|                       the class Result and the class NestLoop nodes both want
226  *|                       a slot called "OuterTuple" so they both have to inherit
227  *|                       it from some other class.  In this case they inherit
228  *|                       it from CommonState.  "CommonState" and "CommonScanState" are
229  *|                       the best names I could come up with for this sort of
230  *|                       stuff.
231  *|
232  *|                       As a result, many classes have extra slots which they
233  *|                       don't use.  These slots are denoted (unused) in the
234  *|                       comment preceeding the class definition.      If you
235  *|                       comes up with a better idea of a way of doing things
236  *|                       along these lines, then feel free to make your idea
237  *|                       known to me.. -cim 10/15/89
238  * ----------------
239  */
240
241 /* ----------------------------------------------------------------
242  *                               Common Executor State Information
243  * ----------------------------------------------------------------
244  */
245
246 /* BaseNode removed -- base_id moved into CommonState           - jolly */
247
248 /* ----------------
249  *       CommonState information
250  *
251  *|             this is a bogus class used to hold slots so other
252  *|             nodes can inherit them...
253  *
254  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
255  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
256  *              ExprContext                node's current expression context
257  *              ProjInfo                   info this node uses to form tuple projections
258  *              NumScanAttributes  size of ScanAttributes array
259  *              ScanAttributes     attribute numbers of interest in this tuple
260  *
261  * ----------------
262  */
263 typedef struct CommonState
264 {
265         NodeTag         type;                   /* its first field is NodeTag */
266         int                     cs_base_id;
267         TupleTableSlot *cs_OuterTupleSlot;
268         TupleTableSlot *cs_ResultTupleSlot;
269         ExprContext *cs_ExprContext;
270         ProjectionInfo *cs_ProjInfo;
271         bool            cs_TupFromTlist;
272 } CommonState;
273
274
275 /* ----------------------------------------------------------------
276  *                               Control Node State Information
277  * ----------------------------------------------------------------
278  */
279
280 /* ----------------
281  *       ResultState information
282  *
283  *              done                       flag which tells us to quit when we
284  *                                                 have already returned a constant tuple.
285  *
286  *       CommonState information
287  *
288  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
289  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
290  *              ExprContext                node's current expression context
291  *              ProjInfo                   info this node uses to form tuple projections
292  *              NumScanAttributes  size of ScanAttributes array
293  *              ScanAttributes     attribute numbers of interest in this tuple
294  * ----------------
295  */
296 typedef struct ResultState
297 {
298         CommonState cstate;                     /* its first field is NodeTag */
299         bool            rs_done;
300         bool            rs_checkqual;
301 } ResultState;
302
303 /* ----------------
304  *       AppendState information
305  *
306  *              append nodes have this field "unionplans" which is this
307  *              list of plans to execute in sequence..  these variables
308  *              keep track of things..
309  *
310  *              whichplan               which plan is being executed
311  *              nplans                  how many plans are in the list
312  *              initialized             array of ExecInitNode() results
313  *              rtentries               range table for the current plan
314  *              result_relation_info_list  array of each subplan's result relation info
315  *              junkFilter_list  array of each subplan's junk filter
316  *
317  *       CommonState information
318  *
319  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
320  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
321  *              ExprContext                node's current expression context
322  *              ProjInfo                   info this node uses to form tuple projections
323  *              NumScanAttributes  size of ScanAttributes array
324  *              ScanAttributes     attribute numbers of interest in this tuple
325  * ----------------
326  */
327 typedef struct AppendState
328 {
329         CommonState cstate;                     /* its first field is NodeTag */
330         int                     as_whichplan;
331         int                     as_nplans;
332         bool       *as_initialized;
333         List       *as_rtentries;
334         List       *as_result_relation_info_list;
335         List       *as_junkFilter_list;
336 } AppendState;
337
338 /* ----------------------------------------------------------------
339  *                               Scan State Information
340  * ----------------------------------------------------------------
341  */
342
343 /* ----------------
344  *       CommonScanState information
345  *
346  *              CommonScanState is a class like CommonState, but is used more
347  *              by the nodes like SeqScan and Sort which want to
348  *              keep track of an underlying relation.
349  *
350  *              currentRelation    relation being scanned
351  *              currentScanDesc    current scan descriptor for scan
352  *              ScanTupleSlot      pointer to slot in tuple table holding scan tuple
353  *
354  *       CommonState information
355  *
356  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
357  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
358  *              ExprContext                node's current expression context
359  *              ProjInfo                   info this node uses to form tuple projections
360  *              NumScanAttributes  size of ScanAttributes array
361  *              ScanAttributes     attribute numbers of interest in this tuple
362  * ----------------
363  */
364 typedef struct CommonScanState
365 {
366         CommonState cstate;                     /* its first field is NodeTag */
367         Relation        css_currentRelation;
368         HeapScanDesc css_currentScanDesc;
369         TupleTableSlot *css_ScanTupleSlot;
370 } CommonScanState;
371
372 /* ----------------
373  *       IndexScanState information
374  *
375  *|             index scans don't use CommonScanState because
376  *|             the underlying AM abstractions for heap scans and
377  *|             index scans are too different..  It would be nice
378  *|             if the current abstraction was more useful but ... -cim 10/15/89
379  *
380  *              IndexPtr                   current index in use
381  *              NumIndices                 number of indices in this scan
382  *              ScanKeys                   Skey structures to scan index rels
383  *              NumScanKeys                array of no of keys in each Skey struct
384  *              RuntimeKeyInfo     array of array of flags for Skeys evaled at runtime
385  *              RelationDescs      ptr to array of relation descriptors
386  *              ScanDescs                  ptr to array of scan descriptors
387  *
388  *       CommonState information
389  *
390  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
391  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
392  *              ExprContext                node's current expression context
393  *              ProjInfo                   info this node uses to form tuple projections
394  *              NumScanAttributes  size of ScanAttributes array
395  *              ScanAttributes     attribute numbers of interest in this tuple
396  * ----------------
397  */
398 typedef struct IndexScanState
399 {
400         CommonState             cstate;                 /* its first field is NodeTag */
401         int                                     iss_NumIndices;
402         int                                     iss_IndexPtr;
403         int                                     iss_MarkIndexPtr;
404         ScanKey                    *iss_ScanKeys;
405         int                                *iss_NumScanKeys;
406         Pointer                         iss_RuntimeKeyInfo;
407         RelationPtr                     iss_RelationDescs;
408         IndexScanDescPtr        iss_ScanDescs;
409         HeapTupleData           iss_htup;
410 } IndexScanState;
411
412
413 /* ----------------------------------------------------------------
414  *                               Join State Information
415  * ----------------------------------------------------------------
416  */
417
418 /* ----------------
419  *       JoinState information
420  *
421  *       CommonState information
422  *
423  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
424  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
425  *              ExprContext                node's current expression context
426  *              ProjInfo                   info this node uses to form tuple projections
427  *              NumScanAttributes  size of ScanAttributes array
428  *              ScanAttributes     attribute numbers of interest in this tuple
429  * ----------------
430  */
431 typedef CommonState JoinState;
432
433 /* ----------------
434  *       NestLoopState information
435  *
436  *              PortalFlag                 Set to enable portals to work.
437  *
438  *       JoinState information
439  *
440  *       CommonState information
441  *
442  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
443  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
444  *              ExprContext                node's current expression context
445  *              ProjInfo                   info this node uses to form tuple projections
446  *              NumScanAttributes  size of ScanAttributes array
447  *              ScanAttributes     attribute numbers of interest in this tuple
448  * ----------------
449  */
450 typedef struct NestLoopState
451 {
452         JoinState       jstate;                 /* its first field is NodeTag */
453         bool            nl_PortalFlag;
454 } NestLoopState;
455
456 /* ----------------
457  *       MergeJoinState information
458  *
459  *              OSortopI                   outerKey1 sortOp innerKey1 ...
460  *              ISortopO                   innerkey1 sortOp outerkey1 ...
461  *              JoinState                  current "state" of join. see executor.h
462  *              MarkedTupleSlot    pointer to slot in tuple table for marked tuple
463  *
464  *       JoinState information
465  *
466  *       CommonState information
467  *
468  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
469  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
470  *              ExprContext                node's current expression context
471  *              ProjInfo                   info this node uses to form tuple projections
472  *              NumScanAttributes  size of ScanAttributes array
473  *              ScanAttributes     attribute numbers of interest in this tuple
474  * ----------------
475  */
476 typedef struct MergeJoinState
477 {
478         JoinState       jstate;                 /* its first field is NodeTag */
479         List       *mj_OSortopI;
480         List       *mj_ISortopO;
481         int                     mj_JoinState;
482         TupleTableSlot *mj_MarkedTupleSlot;
483 } MergeJoinState;
484
485 /* ----------------
486  *       HashJoinState information
487  *
488  *              hj_HashTable                    address of the hash table for the hashjoin
489  *              hj_HashTableShmId               shared memory id of hash table
490  *              hj_CurBucket                    the current hash bucket that we are searching
491  *                                                              for matches of the current outer tuple
492  *              hj_CurTuple                             the current matching inner tuple in the
493  *                                                              current hash bucket
494  *              hj_CurOTuple                    the current matching inner tuple in the
495  *                                                              current hash overflow chain
496  *              hj_InnerHashKey                 the inner hash key in the hashjoin condition
497  *              hj_OuterBatches                 file descriptors for outer batches
498  *              hj_InnerBatches                 file descriptors for inner batches
499  *              hj_OuterReadPos                 current read position of outer batch
500  *              hj_OuterReadBlk                 current read block of outer batch
501  *              hj_OuterTupleSlot               tuple slot for outer tuples
502  *              hj_HashTupleSlot                tuple slot for hashed tuples
503  *
504  *
505  *
506  *       JoinState information
507  *
508  *       CommonState information
509  *
510  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
511  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
512  *              ExprContext                node's current expression context
513  *              ProjInfo                   info this node uses to form tuple projections
514  *              NumScanAttributes  size of ScanAttributes array
515  *              ScanAttributes     attribute numbers of interest in this tuple
516  * ----------------
517  */
518 typedef struct HashJoinState
519 {
520         JoinState       jstate;                 /* its first field is NodeTag */
521         HashJoinTable hj_HashTable;
522         IpcMemoryId hj_HashTableShmId;
523         HashBucket      hj_CurBucket;
524         HeapTuple       hj_CurTuple;
525         OverflowTuple hj_CurOTuple;
526         Var                *hj_InnerHashKey;
527         File       *hj_OuterBatches;
528         File       *hj_InnerBatches;
529         char       *hj_OuterReadPos;
530         int                     hj_OuterReadBlk;
531         TupleTableSlot *hj_OuterTupleSlot;
532         TupleTableSlot *hj_HashTupleSlot;
533 } HashJoinState;
534
535
536 /* ----------------------------------------------------------------
537  *                               Materialization State Information
538  * ----------------------------------------------------------------
539  */
540
541 /* ----------------
542  *       MaterialState information
543  *
544  *              materialize nodes are used to materialize the results
545  *              of a subplan into a temporary relation.
546  *
547  *              Flag                    indicated whether subplan has been materialized
548  *              TempRelation    temporary relation containing result of executing
549  *                                              the subplan.
550  *
551  *       CommonScanState information
552  *
553  *              currentRelation    relation descriptor of sorted relation
554  *              currentScanDesc    current scan descriptor for scan
555  *              ScanTupleSlot      pointer to slot in tuple table holding scan tuple
556  *
557  *       CommonState information
558  *
559  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
560  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
561  *              ExprContext                node's current expression context
562  *              ProjInfo                   info this node uses to form tuple projections
563  *              NumScanAttributes  size of ScanAttributes array
564  *              ScanAttributes     attribute numbers of interest in this tuple
565  * ----------------
566  */
567 typedef struct MaterialState
568 {
569         CommonScanState csstate;        /* its first field is NodeTag */
570         bool            mat_Flag;
571         Relation        mat_TempRelation;
572 } MaterialState;
573
574 /* ---------------------
575  *      AggregateState information
576  *
577  *              done                    indicated whether aggregate has been materialized
578  * -------------------------
579  */
580 typedef struct AggState
581 {
582         CommonScanState csstate;        /* its first field is NodeTag */
583         bool            agg_done;
584 } AggState;
585
586 /* ---------------------
587  *      GroupState information
588  *
589  * -------------------------
590  */
591 typedef struct GroupState
592 {
593         CommonScanState csstate;        /* its first field is NodeTag */
594         bool            grp_useFirstTuple;              /* first tuple not processed yet */
595         bool            grp_done;
596         HeapTuple       grp_firstTuple;
597 } GroupState;
598
599 /* ----------------
600  *       SortState information
601  *
602  *|             sort nodes are really just a kind of a scan since
603  *|             we implement sorts by retrieveing the entire subplan
604  *|             into a temp relation, sorting the temp relation into
605  *|             another sorted relation, and then preforming a simple
606  *|             unqualified sequential scan on the sorted relation..
607  *|             -cim 10/15/89
608  *
609  *              Flag                    indicated whether relation has been sorted
610  *              Keys                    scan key structures used to keep info on sort keys
611  *              TempRelation    temporary relation containing result of executing
612  *                                              the subplan.
613  *
614  *       CommonScanState information
615  *
616  *              currentRelation    relation descriptor of sorted relation
617  *              currentScanDesc    current scan descriptor for scan
618  *              ScanTupleSlot      pointer to slot in tuple table holding scan tuple
619  *
620  *       CommonState information
621  *
622  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
623  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
624  *              ExprContext                node's current expression context
625  *              ProjInfo                   info this node uses to form tuple projections
626  *              NumScanAttributes  size of ScanAttributes array
627  *              ScanAttributes     attribute numbers of interest in this tuple
628  * ----------------
629  */
630 typedef struct SortState
631 {
632         CommonScanState csstate;        /* its first field is NodeTag */
633         bool            sort_Flag;
634         ScanKey         sort_Keys;
635         bool            cleaned;
636 } SortState;
637
638 /* ----------------
639  *       UniqueState information
640  *
641  *              Unique nodes are used "on top of" sort nodes to discard
642  *              duplicate tuples returned from the sort phase.  Basically
643  *              all it does is compare the current tuple from the subplan
644  *              with the previously fetched tuple stored in OuterTuple and
645  *              if the two are identical, then we just fetch another tuple
646  *              from the sort and try again.
647  *
648  *       CommonState information
649  *
650  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
651  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
652  *              ExprContext                node's current expression context
653  *              ProjInfo                   info this node uses to form tuple projections
654  *              NumScanAttributes  size of ScanAttributes array
655  *              ScanAttributes     attribute numbers of interest in this tuple
656  * ----------------
657  */
658 typedef CommonState UniqueState;
659
660
661 /* ----------------
662  *       HashState information
663  *
664  *              hashBatches                file descriptors for the batches
665  *
666  *       CommonState information
667  *
668  *              OuterTupleSlot     pointer to slot containing current "outer" tuple
669  *              ResultTupleSlot    pointer to slot in tuple table for projected tuple
670  *              ExprContext                node's current expression context
671  *              ProjInfo                   info this node uses to form tuple projections
672  *              NumScanAttributes  size of ScanAttributes array
673  *              ScanAttributes     attribute numbers of interest in this tuple
674  * ----------------
675  */
676 typedef struct HashState
677 {
678         CommonState cstate;                     /* its first field is NodeTag */
679         File       *hashBatches;
680 } HashState;
681
682 /* -----------------------
683  *      TeeState information
684  *        leftPlace  :    next item in the queue unseen by the left parent
685  *        rightPlace :    next item in the queue unseen by the right parent
686  *        lastPlace  :    last item in the queue
687  *        bufferRelname :  name of the relation used as the buffer queue
688  *        bufferRel             :  the relation used as the buffer queue
689  *        mcxt                  :  for now, tee's have their own memory context
690  *                                         may be cleaned up later if portals are cleaned up
691  *
692  * initially, a Tee starts with [left/right]Place variables set to      -1.
693  * on cleanup, queue is free'd when both leftPlace and rightPlace = -1
694  * -------------------------
695 */
696 typedef struct TeeState
697 {
698         CommonState      cstate;                        /* its first field is NodeTag */
699         int                                             tee_leftPlace,
700                                                                 tee_rightPlace,
701                                                                 tee_lastPlace;
702         char                                    *tee_bufferRelname;
703         Relation                        tee_bufferRel;
704         MemoryContext tee_mcxt;
705         HeapScanDesc    tee_leftScanDesc,
706                                                                 tee_rightScanDesc;
707 } TeeState;
708
709 #endif   /* EXECNODES_H */