PostgreSQL Source Code  git master
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-2018, 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 "access/htup.h"
18 #include "nodes/relation.h"
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 extern List *expand_function_arguments(List *args, Oid result_type,
89  HeapTuple func_tuple);
90 
91 #endif /* CLAUSES_H */
Expr * get_notclausearg(Expr *notclause)
Definition: clauses.c:266
bool contain_agg_clause(Node *clause)
Definition: clauses.c:418
char max_parallel_hazard(Query *parse)
Definition: clauses.c:1069
Node * eval_const_expressions(PlannerInfo *root, Node *node)
Definition: clauses.c:2460
bool is_pseudo_constant_clause_relids(Node *clause, Relids relids)
Definition: clauses.c:2251
Expr * make_andclause(List *andclauses)
Definition: clauses.c:328
Index maxWinRef
Definition: clauses.h:26
bool contain_volatile_functions(Node *clause)
Definition: clauses.c:958
bool not_clause(Node *clause)
Definition: clauses.c:237
List * make_ands_implicit(Expr *clause)
Definition: clauses.c:379
Query * inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
Definition: clauses.c:4932
int numWindowFuncs
Definition: clauses.h:25
Node * get_leftop(const Expr *clause)
Definition: clauses.c:200
Definition: nodes.h:516
Node * estimate_expression_value(PlannerInfo *root, Node *node)
Definition: clauses.c:2493
bool contain_leaked_vars(Node *clause)
Definition: clauses.c:1516
unsigned int Oid
Definition: postgres_ext.h:31
void CommuteOpExpr(OpExpr *clause)
Definition: clauses.c:2288
Definition: primnodes.h:163
Expr * make_ands_explicit(List *andclauses)
Definition: clauses.c:368
void get_agg_clause_costs(PlannerInfo *root, Node *clause, AggSplit aggsplit, AggClauseCosts *costs)
Definition: clauses.c:468
Expr * make_notclause(Expr *notclause)
Definition: clauses.c:250
bool contain_volatile_functions_not_nextval(Node *clause)
Definition: clauses.c:1008
Relids find_nonnullable_rels(Node *clause)
Definition: clauses.c:1661
bool contain_window_function(Node *clause)
Definition: clauses.c:728
int NumRelids(Node *clause)
Definition: clauses.c:2273
bool and_clause(Node *clause)
Definition: clauses.c:315
unsigned int Index
Definition: c.h:442
Node * get_rightop(const Expr *clause)
Definition: clauses.c:217
Var * find_forced_null_var(Node *clause)
Definition: clauses.c:2121
bool contain_mutable_functions(Node *clause)
Definition: clauses.c:879
bool is_pseudo_constant_clause(Node *clause)
Definition: clauses.c:2231
AggSplit
Definition: nodes.h:764
bool contain_subplans(Node *clause)
Definition: clauses.c:844
WindowFuncLists * find_window_functions(Node *clause, Index maxWinRef)
Definition: clauses.c:741
bool or_clause(Node *clause)
Definition: clauses.c:281
List * find_forced_null_vars(Node *clause)
Definition: clauses.c:2062
Expr * make_orclause(List *orclauses)
Definition: clauses.c:294
Expr * make_opclause(Oid opno, Oid opresulttype, bool opretset, Expr *leftop, Expr *rightop, Oid opcollid, Oid inputcollid)
Definition: clauses.c:173
bool contain_nonstrict_functions(Node *clause)
Definition: clauses.c:1315
Node * make_and_qual(Node *qual1, Node *qual2)
Definition: clauses.c:349
List * find_nonnullable_vars(Node *clause)
Definition: clauses.c:1869
Definition: pg_list.h:45
List ** windowFuncs
Definition: clauses.h:27
bool is_parallel_safe(PlannerInfo *root, Node *node)
Definition: clauses.c:1088
List * expand_function_arguments(List *args, Oid result_type, HeapTuple func_tuple)
Definition: clauses.c:4114
static struct subre * parse(struct vars *, int, int, struct state *, struct state *)
Definition: regcomp.c:649
void CommuteRowCompareExpr(RowCompareExpr *clause)
Definition: clauses.c:2322
double expression_returns_set_rows(Node *clause)
Definition: clauses.c:803