From: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane), pgsql-hackers(at)postgresql(dot)org, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> |
Subject: | Re: Aggregate ORDER BY patch |
Date: | 2009-12-15 21:01:05 |
Message-ID: | 87hbrsrm8q.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:
>> Query-level DISTINCT shouldn't allow columns in the order by that
>> aren't in the select list because those columns _do not exist_ at
>> the point that ordering logically takes place (even though in the
>> implementation, they might).
>> This isn't the case for aggregate order by.
Tom> I entirely disagree. Why should the semantics of this
Tom> combination of ORDER BY and DISTINCT be different from what they
Tom> are at the query top level? We made other decisions about this
Tom> feature on the basis of making the two cases work alike, and I
Tom> don't think you've made an adequate argument for making them act
Tom> differently.
A case could possibly be made that the behaviour of DISTINCT at top
level is wrong, or at least less useful than need be.
Notice that there are cases where agg(distinct x order by x) is
nondeterministic while agg(distinct x order by x,y) is deterministic.
In my view that alone is a good argument for allowing it.
--
Andrew (irc:RhodiumToad)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-12-15 21:10:39 | Re: Aggregate ORDER BY patch |
Previous Message | Tom Lane | 2009-12-15 20:48:49 | Re: Aggregate ORDER BY patch |