Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.
Date
Msg-id 3728.1251905794@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-bugs
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Tom Lane wrote:
>> With the fix I was just about to apply, all four cases give the first
>> set of results.  This clearly satisfies the principle of least
>> astonishment, at least more nearly than what we have; but it equally
>> clearly is *not* going to restore 8.4 to work just like 8.3.

> Right, 8.3 had the same underlying problem, 8.4 just makes it more
> visible as it's better at flattening subqueries.

What is interesting is that the CASE in the OP's original submission
is apparently only there to dodge the visible-since-8.0 version of
the problem; at least I can't see that it does anything else useful.
The complaint apparently is not so much that 8.3 was right, as that
the workaround for its bug stopped working ...

>> ...  So I'm leaning to patching
>> 8.4 and leaving the older branches alone.
>>
>> Thoughts?

> Seems reasonable.

Will apply fix shortly --- I thought of one minor improvement to
make (the code as it stands is generating redundant PlaceHolderVars).

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: BUG #5028: CASE returns ELSE value always when typeis"char"
Next
From: Sam Mason
Date:
Subject: Re: BUG #5028: CASE returns ELSE value always when type is"char"