diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-12 15:49:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-12 15:49:42 +0000 |
commit | a0bf885f9eaccadd23b766ecbc064f17f06ae883 (patch) | |
tree | 62b65e5cf1a8ec02ece3a98c15457ddff018bb94 /src/include/optimizer/clauses.h | |
parent | debb072886efcb15e7f0825e35b168afe316d37d (diff) | |
download | postgresql-a0bf885f9eaccadd23b766ecbc064f17f06ae883.tar.gz postgresql-a0bf885f9eaccadd23b766ecbc064f17f06ae883.zip |
Phase 2 of read-only-plans project: restructure expression-tree nodes
so that all executable expression nodes inherit from a common supertype
Expr. This is somewhat of an exercise in code purity rather than any
real functional advance, but getting rid of the extra Oper or Func node
formerly used in each operator or function call should provide at least
a little space and speed improvement.
initdb forced by changes in stored-rules representation.
Diffstat (limited to 'src/include/optimizer/clauses.h')
-rw-r--r-- | src/include/optimizer/clauses.h | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h index da0fe4c5102..8da7a8688ef 100644 --- a/src/include/optimizer/clauses.h +++ b/src/include/optimizer/clauses.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: clauses.h,v 1.56 2002/12/01 21:05:14 tgl Exp $ + * $Id: clauses.h,v 1.57 2002/12/12 15:49:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,23 +16,28 @@ #include "nodes/relation.h" -extern Expr *make_clause(int type, Node *oper, List *args); -extern bool is_opclause(Node *clause); -extern Expr *make_opclause(Oper *op, Var *leftop, Var *rightop); + +#define is_opclause(clause) ((clause) != NULL && IsA(clause, OpExpr)) +#define is_funcclause(clause) ((clause) != NULL && IsA(clause, FuncExpr)) +#define is_subplan(clause) ((clause) != NULL && IsA(clause, SubPlanExpr)) + + +extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset, + Expr *leftop, Expr *rightop); extern Var *get_leftop(Expr *clause); extern Var *get_rightop(Expr *clause); -extern bool is_funcclause(Node *clause); -extern Expr *make_funcclause(Func *func, List *funcargs); - -extern bool or_clause(Node *clause); -extern Expr *make_orclause(List *orclauses); +extern Expr *make_funcclause(Oid funcid, Oid funcresulttype, bool funcretset, + CoercionForm funcformat, List *funcargs); extern bool not_clause(Node *clause); extern Expr *make_notclause(Expr *notclause); extern Expr *get_notclausearg(Expr *notclause); +extern bool or_clause(Node *clause); +extern Expr *make_orclause(List *orclauses); + extern bool and_clause(Node *clause); extern Expr *make_andclause(List *andclauses); extern Node *make_and_qual(Node *qual1, Node *qual2); @@ -60,7 +65,7 @@ extern bool has_distinct_on_clause(Query *query); extern void clause_get_relids_vars(Node *clause, Relids *relids, List **vars); extern int NumRelids(Node *clause); -extern void CommuteClause(Expr *clause); +extern void CommuteClause(OpExpr *clause); extern Node *eval_const_expressions(Node *node); @@ -78,8 +83,4 @@ extern bool query_tree_walker(Query *query, bool (*walker) (), extern void query_tree_mutator(Query *query, Node *(*mutator) (), void *context, int flags); -#define is_subplan(clause) ((clause) != NULL && \ - IsA(clause, Expr) && \ - ((Expr *) (clause))->opType == SUBPLAN_EXPR) - #endif /* CLAUSES_H */ |