Re: idea - new aggregates median, listagg - Mailing list pgsql-hackers

From David Fetter
Subject Re: idea - new aggregates median, listagg
Date
Msg-id 20091215222225.GA29076@fetter.org
Whole thread Raw
In response to idea - new aggregates median, listagg  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: idea - new aggregates median, listagg  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On Tue, Dec 15, 2009 at 10:28:49PM +0100, Pavel Stehule wrote:
> Hello
> 
> I am looking on new feature - ORDER clause in aggregate, and I thing,
> so we are able to effectively implement some non standard, but well
> known aggregates.
> 
> a) function median - it is relative frequent request - with usually
> slow implementation

Makes a lot of sense.  I suspect we'll have to provide several
different medians, as there are several precise, useful, and
conflicting definitions.  Some examples below:

http://www.simple-talk.com/sql/t-sql-programming/median-workbench/

> b) function listagg (it is analogy of group_concat from MySQL) - it
> should simplify report generating and some other

This is redundant, as it's equivalent to array_to_string(array_agg()).

If it's done as syntactic sugar over that, it's fine.  If it's a
separate implementation, it's a bad idea.  Probably best as an
optional module of some kind.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Range types
Next
From: Peter Eisentraut
Date:
Subject: Re: Compiling HEAD with -Werror int 64-bit mode