summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-02-25 03:30:38 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-02-25 03:30:38 +0000
commite549722a8b2fcc5b2ad9a9bd53948466ea5dae26 (patch)
treea55ae57bb515b353f70a8321a0751ed5aca40044 /src/backend/optimizer/util
parent7380b6384b5a0b25fa7dfa7447dbf95ff1c4b8da (diff)
Get rid of the rather fuzzily defined FlattenedSubLink node type in favor of
making pull_up_sublinks() construct a full-blown JoinExpr tree representation of IN/EXISTS SubLinks that it is able to convert to semi or anti joins. This makes pull_up_sublinks() a shade more complex, but the gain in semantic clarity is worth it. I still have more to do in this area to address the previously-discussed problems, but this commit in itself fixes at least one bug in HEAD, as shown by added regression test case.
Diffstat (limited to 'src/backend/optimizer/util')
-rw-r--r--src/backend/optimizer/util/clauses.c38
-rw-r--r--src/backend/optimizer/util/var.c20
2 files changed, 2 insertions, 56 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 65c9b614584..c9c7270d2b8 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.275 2009/01/09 15:46:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.276 2009/02/25 03:30:37 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -1300,15 +1300,6 @@ find_nonnullable_rels_walker(Node *node, bool top_level)
expr->booltesttype == IS_NOT_UNKNOWN))
result = find_nonnullable_rels_walker((Node *) expr->arg, false);
}
- else if (IsA(node, FlattenedSubLink))
- {
- /* JOIN_SEMI sublinks preserve strictness, but JOIN_ANTI ones don't */
- FlattenedSubLink *expr = (FlattenedSubLink *) node;
-
- if (expr->jointype == JOIN_SEMI)
- result = find_nonnullable_rels_walker((Node *) expr->quals,
- top_level);
- }
else if (IsA(node, PlaceHolderVar))
{
PlaceHolderVar *phv = (PlaceHolderVar *) node;
@@ -1511,15 +1502,6 @@ find_nonnullable_vars_walker(Node *node, bool top_level)
expr->booltesttype == IS_NOT_UNKNOWN))
result = find_nonnullable_vars_walker((Node *) expr->arg, false);
}
- else if (IsA(node, FlattenedSubLink))
- {
- /* JOIN_SEMI sublinks preserve strictness, but JOIN_ANTI ones don't */
- FlattenedSubLink *expr = (FlattenedSubLink *) node;
-
- if (expr->jointype == JOIN_SEMI)
- result = find_nonnullable_vars_walker((Node *) expr->quals,
- top_level);
- }
else if (IsA(node, PlaceHolderVar))
{
PlaceHolderVar *phv = (PlaceHolderVar *) node;
@@ -2943,24 +2925,6 @@ eval_const_expressions_mutator(Node *node,
newbtest->booltesttype = btest->booltesttype;
return (Node *) newbtest;
}
- if (IsA(node, FlattenedSubLink))
- {
- FlattenedSubLink *fslink = (FlattenedSubLink *) node;
- FlattenedSubLink *newfslink;
- Expr *quals;
-
- /* Simplify and also canonicalize the arguments */
- quals = (Expr *) eval_const_expressions_mutator((Node *) fslink->quals,
- context);
- quals = canonicalize_qual(quals);
-
- newfslink = makeNode(FlattenedSubLink);
- newfslink->jointype = fslink->jointype;
- newfslink->lefthand = fslink->lefthand;
- newfslink->righthand = fslink->righthand;
- newfslink->quals = quals;
- return (Node *) newfslink;
- }
if (IsA(node, PlaceHolderVar) && context->estimate)
{
/*
diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c
index 64d6bba1480..7768712b569 100644
--- a/src/backend/optimizer/util/var.c
+++ b/src/backend/optimizer/util/var.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.83 2009/01/01 17:23:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.84 2009/02/25 03:30:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -766,24 +766,6 @@ flatten_join_alias_vars_mutator(Node *node,
/* Recurse in case join input is itself a join */
return flatten_join_alias_vars_mutator(newvar, context);
}
- if (IsA(node, FlattenedSubLink))
- {
- /* Copy the FlattenedSubLink node with correct mutation of subnodes */
- FlattenedSubLink *fslink;
-
- fslink = (FlattenedSubLink *) expression_tree_mutator(node,
- flatten_join_alias_vars_mutator,
- (void *) context);
- /* now fix FlattenedSubLink's relid sets */
- if (context->sublevels_up == 0)
- {
- fslink->lefthand = alias_relid_set(context->root,
- fslink->lefthand);
- fslink->righthand = alias_relid_set(context->root,
- fslink->righthand);
- }
- return (Node *) fslink;
- }
if (IsA(node, PlaceHolderVar))
{
/* Copy the PlaceHolderVar node with correct mutation of subnodes */