Re: non-deterministic error related to MIN/MAX optimization - Mailing list pgsql-bugs

From Tom Lane
Subject Re: non-deterministic error related to MIN/MAX optimization
Date
Msg-id 22280.1220831886@sss.pgh.pa.us
Whole thread Raw
In response to Re: non-deterministic error related to MIN/MAX optimization  ("Pavel Stehule" <pavel.stehule@gmail.com>)
List pgsql-bugs
[ back to this issue ]

"Pavel Stehule" <pavel.stehule@gmail.com> writes:
> 2008/8/26 Tom Lane <tgl@sss.pgh.pa.us>:
>> Jeff Davis <pgsql@j-davis.com> writes:
>>> ERROR:  set-valued function called in context that cannot accept a set
>>
>> Hmm ... after a bit of poking at it, the reason it's failing is that Agg
>> plan nodes don't support SRFs in their targetlists.  (Group nodes don't
>> either.)  Kind of interesting that no one ever complained about that
>> before ... although given that plpgsql SRFs don't work in targetlists
>> anyway, maybe it's been masked for common uses.
>>
>> I'm not entirely sure if we should add SRF support to Agg/Group or just
>> write it off as being a deprecated feature anyhow.  Given the
>> definitional issues involved with multiple SRFs in the same targetlist,
>> putting more effort into the feature doesn't seem like a great
>> investment of time.

> I dislike this feature - sometime we can do nice hack with it, but
> it's very dificult readable.

I think the plan has been to implement SQL's LATERAL feature and then
deprecate SRFs-in-targetlist.  However, I don't see anyone working on
LATERAL for 8.4, and even if it did happen for 8.4, it would be a long
time after that before we could consider removing SRFs-in-targetlist
support altogether.  (Besides, is LATERAL really so much more readable?)
In the meantime we have a bug or at least a functionality gap here.

So I'm thinking that we ought to fix nodeAgg and nodeGroup to support
this.  It doesn't look like it will really take much extra code.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #4410: Indexes not seen right away
Next
From: Craig Ringer
Date:
Subject: Re: BUG #4409: postmaster service is stopped