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

From Scott Bailey
Subject Re: idea - new aggregates median, listagg
Date
Msg-id 4B290691.8070508@comcast.net
Whole thread Raw
In response to Re: idea - new aggregates median, listagg  (Thom Brown <thombrown@gmail.com>)
List pgsql-hackers
Thom Brown wrote:
> 2009/12/15 Pavel Stehule <pavel.stehule@gmail.com 
> <mailto:pavel.stehule@gmail.com>>
> 
>     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
> 
>     b) function listagg (it is analogy of group_concat from MySQL) - it
>     should simplify report generating and some other
> 
>     What is your opinion? Do you like to see these functions in core?
> 
> 
> 
> I'm probably missing the point here, but when I originally saw MySQL's 
> group_concat function, I found it odd that it featured ordering 
> functionality.  Shouldn't the order by determined by the query itself?  
> Otherwise it's almost as if its separating the relationship between the 
> result column and the resultset.

For xmlagg in particular, it is quite useful to be able order the 
results. And sorting the query doesn't work for ordering the agg unless 
you do it in a subquery. Oracle has this functionality and it is quite 
handy. It would be nice to see listagg with the option to order as well.

Scott


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Patch: Remove gcc dependency in definition of inline functions
Next
From: Tom Lane
Date:
Subject: Re: Patch: Remove gcc dependency in definition of inline functions