~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/include/optimizer/clauses.h

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * clauses.h
 
4
 *        prototypes for clauses.c.
 
5
 *
 
6
 *
 
7
 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
 
8
 * Portions Copyright (c) 1994, Regents of the University of California
 
9
 *
 
10
 * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.77.4.1 2005-01-28 19:36:33 tgl Exp $
 
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
#define is_subplan(clause)              ((clause) != NULL && IsA(clause, SubPlan))
 
23
 
 
24
typedef struct
 
25
{
 
26
        int                     numAggs;                        /* total number of aggregate calls */
 
27
        int                     numDistinctAggs;        /* number that use DISTINCT */
 
28
        Size            transitionSpace;        /* for pass-by-ref transition data */
 
29
} AggClauseCounts;
 
30
 
 
31
 
 
32
extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset,
 
33
                          Expr *leftop, Expr *rightop);
 
34
extern Node *get_leftop(Expr *clause);
 
35
extern Node *get_rightop(Expr *clause);
 
36
 
 
37
extern bool not_clause(Node *clause);
 
38
extern Expr *make_notclause(Expr *notclause);
 
39
extern Expr *get_notclausearg(Expr *notclause);
 
40
 
 
41
extern bool or_clause(Node *clause);
 
42
extern Expr *make_orclause(List *orclauses);
 
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 void count_agg_clauses(Node *clause, AggClauseCounts *counts);
 
52
 
 
53
extern bool expression_returns_set(Node *clause);
 
54
 
 
55
extern bool contain_subplans(Node *clause);
 
56
 
 
57
extern bool contain_mutable_functions(Node *clause);
 
58
extern bool contain_volatile_functions(Node *clause);
 
59
extern bool contain_nonstrict_functions(Node *clause);
 
60
 
 
61
extern bool is_pseudo_constant_clause(Node *clause);
 
62
extern bool is_pseudo_constant_clause_relids(Node *clause, Relids relids);
 
63
extern List *pull_constant_clauses(List *quals, List **constantQual);
 
64
 
 
65
extern bool has_distinct_clause(Query *query);
 
66
extern bool has_distinct_on_clause(Query *query);
 
67
 
 
68
extern int      NumRelids(Node *clause);
 
69
extern void CommuteClause(OpExpr *clause);
 
70
 
 
71
extern Node *strip_implicit_coercions(Node *node);
 
72
 
 
73
extern void set_coercionform_dontcare(Node *node);
 
74
 
 
75
extern Node *eval_const_expressions(Node *node);
 
76
 
 
77
extern Node *estimate_expression_value(Node *node);
 
78
 
 
79
extern bool expression_tree_walker(Node *node, bool (*walker) (),
 
80
                                                                                           void *context);
 
81
extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (),
 
82
                                                                                                 void *context);
 
83
 
 
84
/* flags bits for query_tree_walker and query_tree_mutator */
 
85
#define QTW_IGNORE_RT_SUBQUERIES        0x01            /* subqueries in rtable */
 
86
#define QTW_IGNORE_JOINALIASES          0x02            /* JOIN alias var lists */
 
87
#define QTW_DONT_COPY_QUERY                     0x04            /* do not copy top Query */
 
88
 
 
89
extern bool query_tree_walker(Query *query, bool (*walker) (),
 
90
                                                                                  void *context, int flags);
 
91
extern Query *query_tree_mutator(Query *query, Node *(*mutator) (),
 
92
                                                                                         void *context, int flags);
 
93
 
 
94
extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (),
 
95
                                                                                           void *context, int flags);
 
96
extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (),
 
97
                                                                                           void *context, int flags);
 
98
 
 
99
#endif   /* CLAUSES_H */