1 /*-------------------------------------------------------------------------
4 * prototypes for clauses.c.
7 * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $Id: clauses.h,v 1.43 2001/03/22 04:00:53 momjian Exp $
12 *-------------------------------------------------------------------------
17 #include "nodes/relation.h"
20 * Flag bits returned by get_relattval().
21 * These are used in selectivity-estimation routines, too.
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 */
27 extern Expr *make_clause(int type, Node *oper, List *args);
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);
34 extern bool is_funcclause(Node *clause);
35 extern Expr *make_funcclause(Func *func, List *funcargs);
37 extern bool or_clause(Node *clause);
38 extern Expr *make_orclause(List *orclauses);
40 extern bool not_clause(Node *clause);
41 extern Expr *make_notclause(Expr *notclause);
42 extern Expr *get_notclausearg(Expr *notclause);
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);
50 extern bool contain_agg_clause(Node *clause);
51 extern List *pull_agg_clause(Node *clause);
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);
57 extern bool contain_noncachable_functions(Node *clause);
59 extern bool is_pseudo_constant_clause(Node *clause);
60 extern List *pull_constant_clauses(List *quals, List **constantQual);
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);
71 extern Node *eval_const_expressions(Node *node);
73 extern bool expression_tree_walker(Node *node, bool (*walker) (),
75 extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
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);
82 #define is_subplan(clause) ((clause) != NULL && \
83 IsA(clause, Expr) && \
84 ((Expr *) (clause))->opType == SUBPLAN_EXPR)
86 #endif /* CLAUSES_H */