aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes/execnodes.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-02-12 17:33:21 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-02-12 17:33:21 +0000
commitec4be2ee6827b6bd85e0813c7a8993cfbb0e6fa7 (patch)
treef4f98eb0f5ff45dbcd23778a1c683a1f597431b7 /src/include/nodes/execnodes.h
parenta5348fafd182d5b84c89b43af3746711ce28f319 (diff)
downloadpostgresql-ec4be2ee6827b6bd85e0813c7a8993cfbb0e6fa7.tar.gz
postgresql-ec4be2ee6827b6bd85e0813c7a8993cfbb0e6fa7.zip
Extend the set of frame options supported for window functions.
This patch allows the frame to start from CURRENT ROW (in either RANGE or ROWS mode), and it also adds support for ROWS n PRECEDING and ROWS n FOLLOWING start and end points. (RANGE value PRECEDING/FOLLOWING isn't there yet --- the grammar works, but that's all.) Hitoshi Harada, reviewed by Pavel Stehule
Diffstat (limited to 'src/include/nodes/execnodes.h')
-rw-r--r--src/include/nodes/execnodes.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 866cd3ef3fd..4d9dfc4c82c 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.217 2010/01/05 23:25:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.218 2010/02/12 17:33:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1595,23 +1595,36 @@ typedef struct WindowAggState
FmgrInfo *ordEqfunctions; /* equality funcs for ordering columns */
Tuplestorestate *buffer; /* stores rows of current partition */
int current_ptr; /* read pointer # for current */
- int agg_ptr; /* read pointer # for aggregates */
int64 spooled_rows; /* total # of rows in buffer */
int64 currentpos; /* position of current row in partition */
+ int64 frameheadpos; /* current frame head position */
int64 frametailpos; /* current frame tail position */
+ /* use struct pointer to avoid including windowapi.h here */
+ struct WindowObjectData *agg_winobj; /* winobj for aggregate fetches */
+ int64 aggregatedbase; /* start row for current aggregates */
int64 aggregatedupto; /* rows before this one are aggregated */
- MemoryContext wincontext; /* context for partition-lifespan data */
+ int frameOptions; /* frame_clause options, see WindowDef */
+ ExprState *startOffset; /* expression for starting bound offset */
+ ExprState *endOffset; /* expression for ending bound offset */
+ Datum startOffsetValue; /* result of startOffset evaluation */
+ Datum endOffsetValue; /* result of endOffset evaluation */
+
+ MemoryContext partcontext; /* context for partition-lifespan data */
+ MemoryContext aggcontext; /* context for each aggregate data */
ExprContext *tmpcontext; /* short-term evaluation context */
+ bool all_first; /* true if the scan is starting */
bool all_done; /* true if the scan is finished */
bool partition_spooled; /* true if all tuples in current
* partition have been spooled into
* tuplestore */
- bool more_partitions;/* true if there's more partitions after this
- * one */
- bool frametail_valid;/* true if frametailpos is known up to date
- * for current row */
+ bool more_partitions; /* true if there's more partitions after
+ * this one */
+ bool framehead_valid; /* true if frameheadpos is known up to date
+ * for current row */
+ bool frametail_valid; /* true if frametailpos is known up to date
+ * for current row */
TupleTableSlot *first_part_slot; /* first tuple of current or next
* partition */