Re: idea - new aggregates median, listagg

From: David Fetter <david(at)fetter(dot)org>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: idea - new aggregates median, listagg
Date: 2009-12-15 22:22:25
Message-ID: 20091215222225.GA29076@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2009-12-15 22:24:46 Re: Compiling HEAD with -Werror int 64-bit mode
Previous Message Tom Lane 2009-12-15 22:17:30 Re: Range types