Skip to content

Commit 136828c

Browse files
committed
Ooops, didn't cut-and-paste quite enough code from ResolveNew;
with result that flatten_join_alias_vars failed to descend into subselects.
1 parent 57ce0f8 commit 136828c

File tree

1 file changed

+19
-1
lines changed
  • src/backend/optimizer/util

1 file changed

+19
-1
lines changed

src/backend/optimizer/util/var.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.44 2003/01/15 19:35:44 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.45 2003/01/16 18:26:02 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -360,6 +360,23 @@ flatten_join_alias_vars_mutator(Node *node,
360360
/* expand it; recurse in case join input is itself a join */
361361
return flatten_join_alias_vars_mutator(newvar, context);
362362
}
363+
364+
/*
365+
* Since expression_tree_mutator won't touch subselects, we have to
366+
* handle them specially.
367+
*/
368+
if (IsA(node, SubLink))
369+
{
370+
SubLink *sublink = (SubLink *) node;
371+
SubLink *newnode;
372+
373+
FLATCOPY(newnode, sublink, SubLink);
374+
MUTATE(newnode->lefthand, sublink->lefthand, List *,
375+
flatten_join_alias_vars_mutator, context);
376+
MUTATE(newnode->subselect, sublink->subselect, Node *,
377+
flatten_join_alias_vars_mutator, context);
378+
return (Node *) newnode;
379+
}
363380
if (IsA(node, Query))
364381
{
365382
/* Recurse into RTE subquery or not-yet-planned sublink subquery */
@@ -375,6 +392,7 @@ flatten_join_alias_vars_mutator(Node *node,
375392
}
376393
/* Already-planned tree not supported */
377394
Assert(!is_subplan(node));
395+
378396
return expression_tree_mutator(node, flatten_join_alias_vars_mutator,
379397
(void *) context);
380398
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy