7
7
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
10
* $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.204 2009/04/08 21:51:38 petere Exp $
10
* $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.205 2009/06/11 14:49:11 momjian Exp $
12
12
*-------------------------------------------------------------------------
18
18
#include "access/heapam.h"
19
19
#include "access/skey.h"
20
20
#include "nodes/params.h"
21
#include "nodes/plannodes.h"
22
#include "nodes/tidbitmap.h"
21
#include "nodes/plannodes.h"
22
#include "nodes/tidbitmap.h"
23
23
#include "utils/hsearch.h"
24
24
#include "utils/rel.h"
25
25
#include "utils/snapshot.h"
120
120
ParamListInfo ecxt_param_list_info; /* for other param types */
123
* Values to substitute for Aggref nodes in the expressions of an Agg node,
124
* or for WindowFunc nodes within a WindowAgg node.
123
* Values to substitute for Aggref nodes in the expressions of an Agg
124
* node, or for WindowFunc nodes within a WindowAgg node.
126
126
Datum *ecxt_aggvalues; /* precomputed values for aggs/windowfuncs */
127
127
bool *ecxt_aggnulls; /* null flags for aggs/windowfuncs */
581
* For a set-returning function (SRF) that returns a tuplestore, we
582
* keep the tuplestore here and dole out the result rows one at a time.
583
* The slot holds the row currently being returned.
581
* For a set-returning function (SRF) that returns a tuplestore, we keep
582
* the tuplestore here and dole out the result rows one at a time. The
583
* slot holds the row currently being returned.
585
585
Tuplestorestate *funcResultStore;
586
586
TupleTableSlot *funcResultSlot;
589
589
* In some cases we need to compute a tuple descriptor for the function's
590
* output. If so, it's stored here.
590
* output. If so, it's stored here.
592
592
TupleDesc funcResultDesc;
593
bool funcReturnsTuple; /* valid when funcResultDesc isn't NULL */
593
bool funcReturnsTuple; /* valid when funcResultDesc isn't
596
597
* We need to store argument values across calls when evaluating a SRF
949
950
TupleTableSlot *ps_ResultTupleSlot; /* slot for my result tuples */
950
951
ExprContext *ps_ExprContext; /* node's expression-evaluation context */
951
952
ProjectionInfo *ps_ProjInfo; /* info for doing tuple projection */
952
bool ps_TupFromTlist; /* state flag for processing set-valued
953
* functions in targetlist */
953
bool ps_TupFromTlist;/* state flag for processing set-valued
954
* functions in targetlist */
956
957
/* ----------------
1527
1528
typedef struct WindowAggState
1529
ScanState ss; /* its first field is NodeTag */
1530
ScanState ss; /* its first field is NodeTag */
1531
1532
/* these fields are filled in by ExecInitExpr: */
1532
List *funcs; /* all WindowFunc nodes in targetlist */
1533
int numfuncs; /* total number of window functions */
1534
int numaggs; /* number that are plain aggregates */
1533
List *funcs; /* all WindowFunc nodes in targetlist */
1534
int numfuncs; /* total number of window functions */
1535
int numaggs; /* number that are plain aggregates */
1536
WindowStatePerFunc perfunc; /* per-window-function information */
1537
WindowStatePerAgg peragg; /* per-plain-aggregate information */
1537
WindowStatePerFunc perfunc; /* per-window-function information */
1538
WindowStatePerAgg peragg; /* per-plain-aggregate information */
1538
1539
FmgrInfo *partEqfunctions; /* equality funcs for partition columns */
1539
FmgrInfo *ordEqfunctions; /* equality funcs for ordering columns */
1540
Tuplestorestate *buffer; /* stores rows of current partition */
1541
int current_ptr; /* read pointer # for current */
1542
int agg_ptr; /* read pointer # for aggregates */
1543
int64 spooled_rows; /* total # of rows in buffer */
1544
int64 currentpos; /* position of current row in partition */
1545
int64 frametailpos; /* current frame tail position */
1546
int64 aggregatedupto; /* rows before this one are aggregated */
1548
MemoryContext wincontext; /* context for partition-lifespan data */
1549
ExprContext *tmpcontext; /* short-term evaluation context */
1551
bool all_done; /* true if the scan is finished */
1552
bool partition_spooled; /* true if all tuples in current partition
1553
* have been spooled into tuplestore */
1554
bool more_partitions; /* true if there's more partitions after
1556
bool frametail_valid; /* true if frametailpos is known up to date
1557
* for current row */
1540
FmgrInfo *ordEqfunctions; /* equality funcs for ordering columns */
1541
Tuplestorestate *buffer; /* stores rows of current partition */
1542
int current_ptr; /* read pointer # for current */
1543
int agg_ptr; /* read pointer # for aggregates */
1544
int64 spooled_rows; /* total # of rows in buffer */
1545
int64 currentpos; /* position of current row in partition */
1546
int64 frametailpos; /* current frame tail position */
1547
int64 aggregatedupto; /* rows before this one are aggregated */
1549
MemoryContext wincontext; /* context for partition-lifespan data */
1550
ExprContext *tmpcontext; /* short-term evaluation context */
1552
bool all_done; /* true if the scan is finished */
1553
bool partition_spooled; /* true if all tuples in current
1554
* partition have been spooled into
1556
bool more_partitions;/* true if there's more partitions after this
1558
bool frametail_valid;/* true if frametailpos is known up to date
1559
* for current row */
1559
1561
TupleTableSlot *first_part_slot; /* first tuple of current or next
1620
1622
HeapTuple grp_firstTuple; /* copy of first tuple of current group */
1621
1623
/* these fields are used in SETOP_HASHED mode: */
1622
1624
TupleHashTable hashtable; /* hash table with one entry per group */
1623
MemoryContext tableContext; /* memory context containing hash table */
1625
MemoryContext tableContext; /* memory context containing hash table */
1624
1626
bool table_filled; /* hash table filled yet? */
1625
1627
TupleHashIterator hashiter; /* for iterating through hash table */