Re: [HACKERS] Bug with ordering aggregates?

2010-05-18 Thread Caleb Welton
This is an area that the SQL standard didn't think through very clearly (IMHO). They actually have two ways of specifying functions like this, one is the ordered aggregate section that this syntax is modeled on, which is indeed very confusing for multi-parameter aggregates. The other is the hypot

Re: [HACKERS] Bug with ordering aggregates?

2010-05-18 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > This doesn't seem right to me: > > > postgres=# select > > postgres-# string_agg(column1::text order by column1 asc,',') > > postgres-# from (values (3),(4),(1),(2)) a; > > string_agg > > > > 1234 > > (1 row) >

Re: [HACKERS] Bug with ordering aggregates?

2010-05-18 Thread Thom Brown
On 18 May 2010 16:37, Stephen Frost wrote: > Greetings, > >  This doesn't seem right to me: > > postgres=# select > postgres-# string_agg(column1::text order by column1 asc,',') > postgres-# from (values (3),(4),(1),(2)) a; >  string_agg > >  1234 > (1 row) > >  I'm thinking we should

Re: [HACKERS] Bug with ordering aggregates?

2010-05-18 Thread Tom Lane
Stephen Frost writes: > This doesn't seem right to me: > postgres=# select > postgres-# string_agg(column1::text order by column1 asc,',') > postgres-# from (values (3),(4),(1),(2)) a; > string_agg > > 1234 > (1 row) Looks fine to me: you have two ordering columns (the second r

[HACKERS] Bug with ordering aggregates?

2010-05-18 Thread Stephen Frost
Greetings, This doesn't seem right to me: postgres=# select postgres-# string_agg(column1::text order by column1 asc,',') postgres-# from (values (3),(4),(1),(2)) a; string_agg 1234 (1 row) I'm thinking we should toss a syntax error here and force the 'order by' to be at th