>>>>> "Tom" == Tom Lane <t...@sss.pgh.pa.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)

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to