Re: non-deterministic error related to MIN/MAX optimization

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Jeff Davis" <pgsql(at)j-davis(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: non-deterministic error related to MIN/MAX optimization
Date: 2008-09-07 23:58:06
Message-ID: 22280.1220831886@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

[ back to this issue ]

"Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> writes:
> 2008/8/26 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> Jeff Davis <pgsql(at)j-davis(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2008-09-08 01:43:57 Re: BUG #4409: postmaster service is stopped
Previous Message Tom Lane 2008-09-07 21:18:31 Re: BUG #4410: Indexes not seen right away