PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
clauses.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * clauses.h
4  * prototypes for clauses.c.
5  *
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/optimizer/clauses.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef CLAUSES_H
15 #define CLAUSES_H
16 
17 #include "nodes/relation.h"
18 
19 
20 #define is_opclause(clause) ((clause) != NULL && IsA(clause, OpExpr))
21 #define is_funcclause(clause) ((clause) != NULL && IsA(clause, FuncExpr))
22 
23 typedef struct
24 {
25  int numWindowFuncs; /* total number of WindowFuncs found */
26  Index maxWinRef; /* windowFuncs[] is indexed 0 .. maxWinRef */
27  List **windowFuncs; /* lists of WindowFuncs for each winref */
29 
30 extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset,
31  Expr *leftop, Expr *rightop,
32  Oid opcollid, Oid inputcollid);
33 extern Node *get_leftop(const Expr *clause);
34 extern Node *get_rightop(const Expr *clause);
35 
36 extern bool not_clause(Node *clause);
37 extern Expr *make_notclause(Expr *notclause);
38 extern Expr *get_notclausearg(Expr *notclause);
39 
40 extern bool or_clause(Node *clause);
41 extern Expr *make_orclause(List *orclauses);
42 
43 extern bool and_clause(Node *clause);
44 extern Expr *make_andclause(List *andclauses);
45 extern Node *make_and_qual(Node *qual1, Node *qual2);
46 extern Expr *make_ands_explicit(List *andclauses);
47 extern List *make_ands_implicit(Expr *clause);
48 
49 extern bool contain_agg_clause(Node *clause);
50 extern void get_agg_clause_costs(PlannerInfo *root, Node *clause,
51  AggSplit aggsplit, AggClauseCosts *costs);
52 
53 extern bool contain_window_function(Node *clause);
54 extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef);
55 
56 extern double expression_returns_set_rows(Node *clause);
57 
58 extern bool contain_subplans(Node *clause);
59 
60 extern bool contain_mutable_functions(Node *clause);
61 extern bool contain_volatile_functions(Node *clause);
62 extern bool contain_volatile_functions_not_nextval(Node *clause);
63 extern char max_parallel_hazard(Query *parse);
64 extern bool is_parallel_safe(PlannerInfo *root, Node *node);
65 extern bool contain_nonstrict_functions(Node *clause);
66 extern bool contain_leaked_vars(Node *clause);
67 
68 extern Relids find_nonnullable_rels(Node *clause);
69 extern List *find_nonnullable_vars(Node *clause);
70 extern List *find_forced_null_vars(Node *clause);
71 extern Var *find_forced_null_var(Node *clause);
72 
73 extern bool is_pseudo_constant_clause(Node *clause);
74 extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids);
75 
76 extern int NumRelids(Node *clause);
77 
78 extern void CommuteOpExpr(OpExpr *clause);
79 extern void CommuteRowCompareExpr(RowCompareExpr *clause);
80 
81 extern Node *eval_const_expressions(PlannerInfo *root, Node *node);
82 
83 extern Node *estimate_expression_value(PlannerInfo *root, Node *node);
84 
86  RangeTblEntry *rte);
87 
88 #endif /* CLAUSES_H */
Expr * get_notclausearg(Expr *notclause)
Definition: clauses.c:265
bool contain_agg_clause(Node *clause)
Definition: clauses.c:417
char max_parallel_hazard(Query *parse)
Definition: clauses.c:1068
Node * eval_const_expressions(PlannerInfo *root, Node *node)
Definition: clauses.c:2429
bool is_pseudo_constant_clause_relids(Node *clause, Relids relids)
Definition: clauses.c:2224
Expr * make_andclause(List *andclauses)
Definition: clauses.c:327
Index maxWinRef
Definition: clauses.h:26
bool contain_volatile_functions(Node *clause)
Definition: clauses.c:957
bool not_clause(Node *clause)
Definition: clauses.c:236
List * make_ands_implicit(Expr *clause)
Definition: clauses.c:378
Query * inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
Definition: clauses.c:4806
int numWindowFuncs
Definition: clauses.h:25
Node * get_leftop(const Expr *clause)
Definition: clauses.c:199
Definition: nodes.h:510
Node * estimate_expression_value(PlannerInfo *root, Node *node)
Definition: clauses.c:2462
bool contain_leaked_vars(Node *clause)
Definition: clauses.c:1489
unsigned int Oid
Definition: postgres_ext.h:31
void CommuteOpExpr(OpExpr *clause)
Definition: clauses.c:2261
Definition: primnodes.h:163
Expr * make_ands_explicit(List *andclauses)
Definition: clauses.c:367
void get_agg_clause_costs(PlannerInfo *root, Node *clause, AggSplit aggsplit, AggClauseCosts *costs)
Definition: clauses.c:467
Expr * make_notclause(Expr *notclause)
Definition: clauses.c:249
bool contain_volatile_functions_not_nextval(Node *clause)
Definition: clauses.c:1007
Relids find_nonnullable_rels(Node *clause)
Definition: clauses.c:1634
bool contain_window_function(Node *clause)
Definition: clauses.c:727
int NumRelids(Node *clause)
Definition: clauses.c:2246
bool and_clause(Node *clause)
Definition: clauses.c:314
unsigned int Index
Definition: c.h:359
Node * get_rightop(const Expr *clause)
Definition: clauses.c:216
Var * find_forced_null_var(Node *clause)
Definition: clauses.c:2094
bool contain_mutable_functions(Node *clause)
Definition: clauses.c:878
bool is_pseudo_constant_clause(Node *clause)
Definition: clauses.c:2204
AggSplit
Definition: nodes.h:758
bool contain_subplans(Node *clause)
Definition: clauses.c:843
WindowFuncLists * find_window_functions(Node *clause, Index maxWinRef)
Definition: clauses.c:740
bool or_clause(Node *clause)
Definition: clauses.c:280
List * find_forced_null_vars(Node *clause)
Definition: clauses.c:2035
Expr * make_orclause(List *orclauses)
Definition: clauses.c:293
Expr * make_opclause(Oid opno, Oid opresulttype, bool opretset, Expr *leftop, Expr *rightop, Oid opcollid, Oid inputcollid)
Definition: clauses.c:172
bool contain_nonstrict_functions(Node *clause)
Definition: clauses.c:1288
Node * make_and_qual(Node *qual1, Node *qual2)
Definition: clauses.c:348
List * find_nonnullable_vars(Node *clause)
Definition: clauses.c:1842
Definition: pg_list.h:45
List ** windowFuncs
Definition: clauses.h:27
bool is_parallel_safe(PlannerInfo *root, Node *node)
Definition: clauses.c:1087
static struct subre * parse(struct vars *, int, int, struct state *, struct state *)
Definition: regcomp.c:649
void CommuteRowCompareExpr(RowCompareExpr *clause)
Definition: clauses.c:2295
double expression_returns_set_rows(Node *clause)
Definition: clauses.c:802