Apparent bug in _make_subplan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vadim Mikheev <vadim(at)krs(dot)ru>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Apparent bug in _make_subplan
Date: 1999-06-16 23:02:05
Message-ID: 1191.929574125@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have been looking at the planner's handling of subplans, and I see
something that I think is wrong, but I'm not quite certain. In
_make_subplan() in backend/optimizer/plan/subselect.c, there is the
code

/* make parParam list */
foreach(lst, plan->extParam)
{
Var *var = nth(lfirsti(lst), PlannerParamVar);

if (var->varlevelsup == PlannerQueryLevel)
node->parParam = lappendi(node->parParam, lfirsti(lst));
}

It looks to me like this code is supposed to find parameters that
reference the immediate parent plan level, as opposed to higher levels.
So, shouldn't it be looking for varlevelsup == 1, not PlannerQueryLevel?

For a first-level subplan, PlannerQueryLevel will be 1 at the time
this code runs, so the result is the same anyway. But I think it
does the wrong thing for more deeply nested subplans. Am I right?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1999-06-16 23:20:23 Re: [HACKERS] 6.5.0 - Overflow bug in AVG( )
Previous Message Cyril VELTER 1999-06-16 22:22:04 Re: [HACKERS] BeOS port