diff options
| author | Tom Lane | 2003-01-15 19:35:48 +0000 |
|---|---|---|
| committer | Tom Lane | 2003-01-15 19:35:48 +0000 |
| commit | de97072e3c88e104a55b0d5c67477f1b0097c003 (patch) | |
| tree | b4b0a243ce6d38ae6aa5cde1e3ef140e229a1615 /src/backend/nodes | |
| parent | 0eed62f34d95d5c7ae7e0931cfe632f4c8373ec0 (diff) | |
Allow merge and hash joins to occur on arbitrary expressions (anything not
containing a volatile function), rather than only on 'Var = Var' clauses
as before. This makes it practical to do flatten_join_alias_vars at the
start of planning, which in turn eliminates a bunch of klugery inside the
planner to deal with alias vars. As a free side effect, we now detect
implied equality of non-Var expressions; for example in
SELECT ... WHERE a.x = b.y and b.y = 42
we will deduce a.x = 42 and use that as a restriction qual on a. Also,
we can remove the restriction introduced 12/5/02 to prevent pullup of
subqueries whose targetlists contain sublinks.
Still TODO: make statistical estimation routines in selfuncs.c and costsize.c
smarter about expressions that are more complex than plain Vars. The need
for this is considerably greater now that we have to be able to estimate
the suitability of merge and hash join techniques on such expressions.
Diffstat (limited to 'src/backend/nodes')
| -rw-r--r-- | src/backend/nodes/copyfuncs.c | 4 | ||||
| -rw-r--r-- | src/backend/nodes/equalfuncs.c | 10 | ||||
| -rw-r--r-- | src/backend/nodes/outfuncs.c | 4 | ||||
| -rw-r--r-- | src/backend/nodes/print.c | 6 |
4 files changed, 14 insertions, 10 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index e260bc65950..8663c6c4a14 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.235 2003/01/10 21:08:10 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.236 2003/01/15 19:35:35 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1059,6 +1059,8 @@ _copyRestrictInfo(RestrictInfo *from) COPY_NODE_FIELD(subclauseindices); /* XXX probably bad */ COPY_SCALAR_FIELD(eval_cost); COPY_SCALAR_FIELD(this_selec); + COPY_INTLIST_FIELD(left_relids); + COPY_INTLIST_FIELD(right_relids); COPY_SCALAR_FIELD(mergejoinoperator); COPY_SCALAR_FIELD(left_sortop); COPY_SCALAR_FIELD(right_sortop); diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 0ef9b3fa220..a4e9e1092d8 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -18,7 +18,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.179 2003/01/10 21:08:10 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.180 2003/01/15 19:35:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -464,10 +464,10 @@ _equalRestrictInfo(RestrictInfo *a, RestrictInfo *b) COMPARE_NODE_FIELD(clause); COMPARE_SCALAR_FIELD(ispusheddown); /* - * We ignore subclauseindices, eval_cost, this_selec, left/right_pathkey, - * and left/right_bucketsize, since they may not be set yet, and should be - * derivable from the clause anyway. Probably it's not really necessary - * to compare any of these remaining fields ... + * We ignore subclauseindices, eval_cost, this_selec, left/right_relids, + * left/right_pathkey, and left/right_bucketsize, since they may not be + * set yet, and should be derivable from the clause anyway. Probably it's + * not really necessary to compare any of these remaining fields ... */ COMPARE_SCALAR_FIELD(mergejoinoperator); COMPARE_SCALAR_FIELD(left_sortop); diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index e7d8fa71ed7..e72b52570e5 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.192 2003/01/10 21:08:11 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.193 2003/01/15 19:35:39 tgl Exp $ * * NOTES * Every node type that can appear in stored rules' parsetrees *must* @@ -952,6 +952,8 @@ _outRestrictInfo(StringInfo str, RestrictInfo *node) WRITE_NODE_FIELD(clause); WRITE_BOOL_FIELD(ispusheddown); WRITE_NODE_FIELD(subclauseindices); + WRITE_INTLIST_FIELD(left_relids); + WRITE_INTLIST_FIELD(right_relids); WRITE_OID_FIELD(mergejoinoperator); WRITE_OID_FIELD(left_sortop); WRITE_OID_FIELD(right_sortop); diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c index dd5186860bf..43b8e99893c 100644 --- a/src/backend/nodes/print.c +++ b/src/backend/nodes/print.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.58 2002/12/12 15:49:28 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.59 2003/01/15 19:35:39 tgl Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -370,10 +370,10 @@ print_expr(Node *expr, List *rtable) { char *opname; - print_expr((Node *) get_leftop(e), rtable); + print_expr(get_leftop(e), rtable); opname = get_opname(((OpExpr *) e)->opno); printf(" %s ", ((opname != NULL) ? opname : "(invalid operator)")); - print_expr((Node *) get_rightop(e), rtable); + print_expr(get_rightop(e), rtable); } else printf("an expr"); |
