OSDN Git Service

Support window functions a la SQL:2008.
[pg-rex/syncrep.git] / src / include / optimizer / clauses.h
index 3623aad..f4e668b 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.95 2008/10/09 19:27:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.96 2008/12/28 18:54:01 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -27,6 +27,13 @@ typedef struct
        Size            transitionSpace;        /* for pass-by-ref transition data */
 } AggClauseCounts;
 
+typedef struct
+{
+       int                     numWindowFuncs; /* total number of WindowFuncs found */
+       Index           maxWinRef;              /* windowFuncs[] is indexed 0 .. maxWinRef */
+       List      **windowFuncs;        /* lists of WindowFuncs for each winref */
+} WindowFuncLists;
+
 
 extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset,
                          Expr *leftop, Expr *rightop);
@@ -47,8 +54,12 @@ extern Expr *make_ands_explicit(List *andclauses);
 extern List *make_ands_implicit(Expr *clause);
 
 extern bool contain_agg_clause(Node *clause);
+extern List *pull_agg_clause(Node *clause);
 extern void count_agg_clauses(Node *clause, AggClauseCounts *counts);
 
+extern bool contain_window_function(Node *clause);
+extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef);
+
 extern double expression_returns_set_rows(Node *clause);
 
 extern bool contain_subplans(Node *clause);