diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-02-25 03:30:38 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-02-25 03:30:38 +0000 |
commit | e549722a8b2fcc5b2ad9a9bd53948466ea5dae26 (patch) | |
tree | a55ae57bb515b353f70a8321a0751ed5aca40044 /src/backend/rewrite/rewriteManip.c | |
parent | 7380b6384b5a0b25fa7dfa7447dbf95ff1c4b8da (diff) | |
download | postgresql-e549722a8b2fcc5b2ad9a9bd53948466ea5dae26.tar.gz postgresql-e549722a8b2fcc5b2ad9a9bd53948466ea5dae26.zip |
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/rewrite/rewriteManip.c')
-rw-r--r-- | src/backend/rewrite/rewriteManip.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index e0403927f32..72cddaaa34c 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.120 2009/01/01 17:23:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.121 2009/02/25 03:30:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -348,23 +348,10 @@ OffsetVarNodes_walker(Node *node, OffsetVarNodes_context *context) { JoinExpr *j = (JoinExpr *) node; - if (context->sublevels_up == 0) + if (j->rtindex && context->sublevels_up == 0) j->rtindex += context->offset; /* fall through to examine children */ } - if (IsA(node, FlattenedSubLink)) - { - FlattenedSubLink *fslink = (FlattenedSubLink *) node; - - if (context->sublevels_up == 0) - { - fslink->lefthand = offset_relid_set(fslink->lefthand, - context->offset); - fslink->righthand = offset_relid_set(fslink->righthand, - context->offset); - } - /* fall through to examine children */ - } if (IsA(node, PlaceHolderVar)) { PlaceHolderVar *phv = (PlaceHolderVar *) node; @@ -530,21 +517,6 @@ ChangeVarNodes_walker(Node *node, ChangeVarNodes_context *context) j->rtindex = context->new_index; /* fall through to examine children */ } - if (IsA(node, FlattenedSubLink)) - { - FlattenedSubLink *fslink = (FlattenedSubLink *) node; - - if (context->sublevels_up == 0) - { - fslink->lefthand = adjust_relid_set(fslink->lefthand, - context->rt_index, - context->new_index); - fslink->righthand = adjust_relid_set(fslink->righthand, - context->rt_index, - context->new_index); - } - /* fall through to examine children */ - } if (IsA(node, PlaceHolderVar)) { PlaceHolderVar *phv = (PlaceHolderVar *) node; @@ -838,7 +810,6 @@ rangeTableEntry_used_walker(Node *node, /* fall through to examine children */ } /* Shouldn't need to handle planner auxiliary nodes here */ - Assert(!IsA(node, FlattenedSubLink)); Assert(!IsA(node, PlaceHolderVar)); Assert(!IsA(node, SpecialJoinInfo)); Assert(!IsA(node, AppendRelInfo)); |