Re: WITHIN GROUP patch - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: WITHIN GROUP patch
Date
Msg-id 877gbhfyu0.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: WITHIN GROUP patch  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> Another thing to think about here is to wonder why the committee choseTom> anything as verbose as "agg(...) WITHIN
GROUP(ORDER BY ...)" in theTom> first place.  The words ORDER BY certainly seem pretty unnecessary.
 

All of the ordered-set functions that the spec defines are intimately tied
to ordering of values, and they allow things like DESC ordering to affect
the results, so it seems obvious to me that they used (ORDER BY ...) because
what follows is both syntactically and semantically similar to any other use
of ORDER BY. (Similar logic seems to have been used for "FILTER (WHERE ...)".)
(The name "ordered set function" also seems quite specific.)

So I don't think there's any greater chance of the spec people adding
a WITHIN GROUP (something_other_than_order_by) construct than of them
adding any other awkward piece of syntax - and if they did, it would
represent an entirely new class of aggregate functions, separate from
ordered set functions and no doubt with its own headaches.

(I realize that expecting sanity from the spec writers is perhaps unwise)

-- 
Andrew (irc:RhodiumToad)



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: WITHIN GROUP patch
Next
From: Peter Eisentraut
Date:
Subject: Re: Wildcard usage enhancements in .pgpass