From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-hackers(at)postgresql(dot)org, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> |
Subject: | Re: Aggregate ORDER BY patch |
Date: | 2009-12-20 15:15:39 |
Message-ID: | 162867790912200715q14e4ba53m644dbbc2e5ff5bd5@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2009/12/19 Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi>:
> On 2009-12-15 23:10 +0200, Tom Lane wrote:
>>
>> Andrew Gierth<andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
>>>
>>> Notice that there are cases where agg(distinct x order by x) is
>>> nondeterministic while agg(distinct x order by x,y) is deterministic.
>>
>> Well, I think what you're really describing is a case where you're using
>> the wrong sort opclass. If the aggregate can distinguish two values of
>> x, and the sort operator can't, use another sort operator that can.
>>
>> If we really wanted to take the above seriously, my opinion is that
>> we ought to introduce DISTINCT ON in aggregates. However, at that
>> point you lose the argument of standard syntax, so it's not real
>> clear why you shouldn't just fall back on
>> select agg(x) from (select distinct on (x) x ... order by x,y)
>
> FWIW, in my opinion the idea behind this patch is to not fall back on hacks
> like that. This patch already goes beyond the standard and having this
> seems like a useful feature in some cases. Although the DISTINCT ON syntax
> would have a bit more resemblance on the existing syntax, I'd still like to
> see agg(distinct x order by x,y).
>
when we are talking about extensions - did you thing about LIMIT clause?
select agg(distinct x order by x limit 10) ..
Regards
Pavel
> Just my $0.02.
>
>
> Regards,
> Marko Tiikkaja
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-12-20 16:20:01 | Re: alpha3 bundled -- please verify |
Previous Message | Martin Pihlak | 2009-12-20 13:39:10 | fdw validation function vs zero catalog id |