Re: Aggregate ORDER BY patch - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Aggregate ORDER BY patch
Date
Msg-id 21281.1260900433@sss.pgh.pa.us
Whole thread Raw
In response to Re: Aggregate ORDER BY patch  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: Aggregate ORDER BY patch  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> Updated version of the aggregate order by patch.

Applied with some editorialization.  The main change I made was to get
rid of all the ad-hoc DISTINCT handling in parse_agg.c and use
transformDistinctClause() instead.  This exposed what I believe to
be a bug in the submitted patch: it accepted cases like
agg(DISTINCT x ORDER BY x,y)

We do not allow that in ordinary query-level DISTINCT because it's
ambiguous --- there might be multiple y values for any particular value
of x, so the ordering is uncertain.  The only way it's not uncertain is
if the sort by x fully determines the order, in which case listing y is
merely useless.  I think this is something that was changed not too
long ago, so maybe you were trying to emulate the old behavior, but
in any case it's better to not have extra code that doesn't behave
quite like the normal case.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: New VACUUM FULL
Next
From: Robert Haas
Date:
Subject: Re: Closing out CommitFest 2009-11