Bug with ordering aggregates?

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Bug with ordering aggregates?
Date: 2010-05-18 15:37:34
Message-ID: 20100518153734.GH21875@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 the end of any arguments to the aggregate.
Alternatively, we should actually make this work like this one does:

postgres=# select
postgres-# string_agg(column1::text,',' order by column1 asc)
postgres-# from (values (3),(4),(1),(2)) a;
string_agg
------------
1,2,3,4
(1 row)

Thanks,

Stephen

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-05-18 15:46:51 Re: Bug with ordering aggregates?
Previous Message Mark Wong 2010-05-18 13:57:24 PDXPUG Day at OSCON 2010