1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

Repair oversight in recent change of dependency extraction code: when

recursing to handle a join alias var, the context had better be set to
be appropriate to the join var's query level.  Per report from Hristo Neshev.
This commit is contained in:
Tom Lane
2002-12-04 20:00:19 +00:00
parent 5b827b68db
commit b8b92c6908

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.12 2002/09/22 00:37:09 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.12.2.1 2002/12/04 20:00:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -789,6 +789,11 @@ find_expr_references_walker(Node *node,
else if (rte->rtekind == RTE_JOIN)
{
/* Scan join output column to add references to join inputs */
List *save_rtables;
/* We must make the context appropriate for join's level */
save_rtables = context->rtables;
context->rtables = rtables;
if (var->varattno <= 0 ||
var->varattno > length(rte->joinaliasvars))
elog(ERROR, "find_expr_references_walker: bogus varattno %d",
@ -796,6 +801,7 @@ find_expr_references_walker(Node *node,
find_expr_references_walker((Node *) nth(var->varattno - 1,
rte->joinaliasvars),
context);
context->rtables = save_rtables;
}
return false;
}