mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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.
This commit is contained in:
@ -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 */
|
||||
|
Reference in New Issue
Block a user