Header And Logo

PostgreSQL
| The world's most advanced open source database.

clauses.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * clauses.h
00004  *    prototypes for clauses.c.
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/optimizer/clauses.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef CLAUSES_H
00015 #define CLAUSES_H
00016 
00017 #include "nodes/relation.h"
00018 
00019 
00020 #define is_opclause(clause)     ((clause) != NULL && IsA(clause, OpExpr))
00021 #define is_funcclause(clause)   ((clause) != NULL && IsA(clause, FuncExpr))
00022 
00023 typedef struct
00024 {
00025     int         numWindowFuncs; /* total number of WindowFuncs found */
00026     Index       maxWinRef;      /* windowFuncs[] is indexed 0 .. maxWinRef */
00027     List      **windowFuncs;    /* lists of WindowFuncs for each winref */
00028 } WindowFuncLists;
00029 
00030 
00031 extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset,
00032               Expr *leftop, Expr *rightop,
00033               Oid opcollid, Oid inputcollid);
00034 extern Node *get_leftop(const Expr *clause);
00035 extern Node *get_rightop(const Expr *clause);
00036 
00037 extern bool not_clause(Node *clause);
00038 extern Expr *make_notclause(Expr *notclause);
00039 extern Expr *get_notclausearg(Expr *notclause);
00040 
00041 extern bool or_clause(Node *clause);
00042 extern Expr *make_orclause(List *orclauses);
00043 
00044 extern bool and_clause(Node *clause);
00045 extern Expr *make_andclause(List *andclauses);
00046 extern Node *make_and_qual(Node *qual1, Node *qual2);
00047 extern Expr *make_ands_explicit(List *andclauses);
00048 extern List *make_ands_implicit(Expr *clause);
00049 
00050 extern bool contain_agg_clause(Node *clause);
00051 extern void count_agg_clauses(PlannerInfo *root, Node *clause,
00052                   AggClauseCosts *costs);
00053 
00054 extern bool contain_window_function(Node *clause);
00055 extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef);
00056 
00057 extern double expression_returns_set_rows(Node *clause);
00058 extern double tlist_returns_set_rows(List *tlist);
00059 
00060 extern bool contain_subplans(Node *clause);
00061 
00062 extern bool contain_mutable_functions(Node *clause);
00063 extern bool contain_volatile_functions(Node *clause);
00064 extern bool contain_nonstrict_functions(Node *clause);
00065 extern bool contain_leaky_functions(Node *clause);
00066 
00067 extern Relids find_nonnullable_rels(Node *clause);
00068 extern List *find_nonnullable_vars(Node *clause);
00069 extern List *find_forced_null_vars(Node *clause);
00070 extern Var *find_forced_null_var(Node *clause);
00071 
00072 extern bool is_pseudo_constant_clause(Node *clause);
00073 extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids);
00074 
00075 extern int  NumRelids(Node *clause);
00076 
00077 extern void CommuteOpExpr(OpExpr *clause);
00078 extern void CommuteRowCompareExpr(RowCompareExpr *clause);
00079 
00080 extern Node *strip_implicit_coercions(Node *node);
00081 
00082 extern Node *eval_const_expressions(PlannerInfo *root, Node *node);
00083 
00084 extern Node *estimate_expression_value(PlannerInfo *root, Node *node);
00085 
00086 extern Query *inline_set_returning_function(PlannerInfo *root,
00087                               RangeTblEntry *rte);
00088 
00089 #endif   /* CLAUSES_H */