Re: Query with aggregate over subselects fails with ERROR: plan should not reference subplan's variable - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Query with aggregate over subselects fails with ERROR: plan should not reference subplan's variable
Date
Msg-id 24894.1240628280@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query with aggregate over subselects fails with ERROR: plan should not reference subplan's variable  (Daniel Grace <dgrace@wingsnw.com>)
List pgsql-bugs
Daniel Grace <dgrace@wingsnw.com> writes:
> No luck there either (runs, but with incorrect results), but since I know
> this isn't a support list and is a bugs list I just would like to point out
> that: Even though what I was doing that triggered the bug is apparently
> incorrect and 'silly', it's still possible that some complicated legitimate
> query might trigger the same problem -- so it may be worth looking into.

Yes, it's certainly a real bug, and we appreciate the bug report.  My
point is just that the reason it's gone undetected is that it's not a
very useful case in practice; and in particular I don't believe that
it's a case you need to solve your problem.

(To be concrete, the failure case as I understand it is a sub-SELECT
containing an aggregate call containing a sub-sub-SELECT, where the
aggregate call actually belongs to the outermost query level according
to the SQL nesting rules.  This is not what you want because the
aggregation is happening, or would happen except for the planner bug,
with entirely the wrong scope for what you want.)

            regards, tom lane

pgsql-bugs by date:

Previous
From: Daniel Grace
Date:
Subject: Re: Query with aggregate over subselects fails with ERROR: plan should not reference subplan's variable
Next
From: "Alejandro Oyarce"
Date:
Subject: BUG #4781: Error de Windows Installer