Re: bogus varno EXPLAIN bug (was Re: Explain analyze gives bogus varno for dblink views)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Kris Jurka <books(at)ejurka(dot)com>, Kris Jurka <jurka(at)ejurka(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: bogus varno EXPLAIN bug (was Re: Explain analyze gives bogus varno for dblink views)
Date: 2002-12-06 19:36:13
Message-ID: 12269.1039203373@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Joe Conway <mail(at)joeconway(dot)com> writes:
> Tom Lane wrote:
>> Ah, thanks for the simplified test case. This is undoubtedly my fault
>> ... will look into it. It is probably somewhat related to the join
>> alias problem found yesterday (ie, somebody somewhere is trying to use
>> the wrong rangetable list to interpret a Var node).

> I spent a bit more time on it last night. Here's an even simpler example:

The answer is that it was brain fade on my part when I wrote the code
for showing plan qualification expressions in EXPLAIN. SubqueryScan
should be classed as a scan node, not an upper node --- it *is* a
primitive scan, from the point of view of the upper query. So any Vars
in its qual have to be resolved against the upper rangetable, not the
subplan's rangetable.

The diff against 7.3 is attached.

regards, tom lane

*** src/backend/commands/explain.c.orig Mon Oct 14 00:26:54 2002
--- src/backend/commands/explain.c Fri Dec 6 14:16:48 2002
***************
*** 432,437 ****
--- 432,438 ----
break;
case T_SeqScan:
case T_TidScan:
+ case T_SubqueryScan:
case T_FunctionScan:
show_scan_qual(plan->qual, false,
"Filter",
***************
*** 483,495 ****
"Filter",
"outer", OUTER, outerPlan(plan),
"inner", INNER, innerPlan(plan),
- str, indent, es);
- break;
- case T_SubqueryScan:
- show_upper_qual(plan->qual,
- "Filter",
- "subplan", 1, ((SubqueryScan *) plan)->subplan,
- "", 0, NULL,
str, indent, es);
break;
case T_Agg:
--- 484,489 ----

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Marques Johansson 2002-12-06 20:02:22 REFERENCES this_table ( oid )
Previous Message Bailey, Scott 2002-12-06 19:33:27 test