OSDN Git Service

pgindent run. Make it all clean.
[pg-rex/syncrep.git] / src / include / optimizer / clauses.h
1 /*-------------------------------------------------------------------------
2  *
3  * clauses.h
4  *        prototypes for clauses.c.
5  *
6  *
7  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * $Id: clauses.h,v 1.43 2001/03/22 04:00:53 momjian Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef CLAUSES_H
15 #define CLAUSES_H
16
17 #include "nodes/relation.h"
18
19 /*
20  *      Flag bits returned by get_relattval().
21  *      These are used in selectivity-estimation routines, too.
22  */
23 #define SEL_CONSTANT    1               /* operator's non-var arg is a constant */
24 #define SEL_RIGHT               2               /* operator's non-var arg is on the right */
25
26
27 extern Expr *make_clause(int type, Node *oper, List *args);
28
29 extern bool is_opclause(Node *clause);
30 extern Expr *make_opclause(Oper *op, Var *leftop, Var *rightop);
31 extern Var *get_leftop(Expr *clause);
32 extern Var *get_rightop(Expr *clause);
33
34 extern bool is_funcclause(Node *clause);
35 extern Expr *make_funcclause(Func *func, List *funcargs);
36
37 extern bool or_clause(Node *clause);
38 extern Expr *make_orclause(List *orclauses);
39
40 extern bool not_clause(Node *clause);
41 extern Expr *make_notclause(Expr *notclause);
42 extern Expr *get_notclausearg(Expr *notclause);
43
44 extern bool and_clause(Node *clause);
45 extern Expr *make_andclause(List *andclauses);
46 extern Node *make_and_qual(Node *qual1, Node *qual2);
47 extern Expr *make_ands_explicit(List *andclauses);
48 extern List *make_ands_implicit(Expr *clause);
49
50 extern bool contain_agg_clause(Node *clause);
51 extern List *pull_agg_clause(Node *clause);
52
53 extern bool contain_subplans(Node *clause);
54 extern List *pull_subplans(Node *clause);
55 extern void check_subplans_for_ungrouped_vars(Node *clause, Query *query);
56
57 extern bool contain_noncachable_functions(Node *clause);
58
59 extern bool is_pseudo_constant_clause(Node *clause);
60 extern List *pull_constant_clauses(List *quals, List **constantQual);
61
62 extern void clause_get_relids_vars(Node *clause, Relids *relids, List **vars);
63 extern int      NumRelids(Node *clause);
64 extern void get_relattval(Node *clause, int targetrelid,
65                           int *relid, AttrNumber *attno,
66                           Datum *constval, int *flag);
67 extern void get_rels_atts(Node *clause, int *relid1,
68                           AttrNumber *attno1, int *relid2, AttrNumber *attno2);
69 extern void CommuteClause(Expr *clause);
70
71 extern Node *eval_const_expressions(Node *node);
72
73 extern bool expression_tree_walker(Node *node, bool (*walker) (),
74                                                                                            void *context);
75 extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
76                                                                                                  void *context);
77 extern bool query_tree_walker(Query *query, bool (*walker) (),
78                                                                          void *context, bool visitQueryRTEs);
79 extern void query_tree_mutator(Query *query, Node *(*mutator) (),
80                                                                          void *context, bool visitQueryRTEs);
81
82 #define is_subplan(clause)      ((clause) != NULL && \
83                                                          IsA(clause, Expr) && \
84                                                          ((Expr *) (clause))->opType == SUBPLAN_EXPR)
85
86 #endif   /* CLAUSES_H */