[email protected] answers me:
in arnt's opinion, pg should've done this correctly. this manipulates pg
in unclean ways. "if we tell pg x, it will do y internally, and we want y"
even though there's no real connection between the x we say and the y we
want.

"SELECT DISTINCT" and "GROUP BY" functionality overlap.
But sometime, they do something different.
In the computation of the quota, we don't care about the order,
but just want to deduplicate the message's part that may be
in two different mailbox.

Well, what we want is for pg to not ORDER BY. But the actual change is to remove DISTINCT, and
http://www.postgresql.org/docs/9.0/static/sql-select.html#SQL-DISTINCT
does not say that DISTINCT implies ORDER BY, or that the rows have to be ordered in any way at all.

It's perfectly possible to implement DISTINCT without ordering, e.g. by using a hash array recording the already-returned rows.

I realise that GROUP BY and DISTINCT are different sometimes. I do not see any reason that they ought to differ in the case at hand.

Arnt

Reply via email to