From: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Atri Sharma <atri(dot)jiit(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Subject: | Re: WITHIN GROUP patch |
Date: | 2013-12-06 23:32:41 |
Message-ID: | 87ob4tefbl.fsf@news-spur.riddles.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
Tom> Not wanting to consider the sort args when there's more than one
Tom> doesn't square with forcing them to be considered when there's
Tom> just one. It's the same aggregate after all,
This logic is only applied in the patch to aggregates that _aren't_
hypothetical.
(thinking out loud:) It might be more consistent to also add the
condition that the single sort column not be a variadic arg. And/or
the condition that it be the same type as the result. Or have a flag
in pg_aggregate to say "this agg returns one of its sorted input
values, so preserve the collation".
>> Consider a construct like:
>> select max(common_val)
>> from (select mode() within group (order by textcol) as common_val
>> from ... group by othercol) s;
Tom> AFAICT none of the SQL-spec aggregates expose the kind of case
Tom> I'm worried about, because none of the ones that can take
Tom> multiple sort columns have a potentially collatable return type.
None of the spec's ordered-set functions expose any collation issue at
all, because they _all_ have non-collatable return types, period.
The problem only arises from the desire to make functions like
percentile_disc and mode applicable to collatable types.
--
Andrew (irc:RhodiumToad)
From | Date | Subject | |
---|---|---|---|
Next Message | MauMau | 2013-12-06 23:52:04 | Re: Re: [RFC] Shouldn't we remove annoying FATAL messages from server log? |
Previous Message | Tom Lane | 2013-12-06 23:25:05 | Re: writable FDWs / update targets confusion |