Re: string_agg delimiter having no effect with order by

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: string_agg delimiter having no effect with order by
Дата
Msg-id AANLkTincegXwDRwOM+gkgUeq7DwK_1SqCqp9yLhMmx20@mail.gmail.com
обсуждение исходный текст
Ответ на Re: string_agg delimiter having no effect with order by  (Thom Brown <thom@linux.com>)
Ответы Re: string_agg delimiter having no effect with order by  (Thom Brown <thom@linux.com>)
Re: string_agg delimiter having no effect with order by  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Wed, Aug 4, 2010 at 6:03 AM, Thom Brown <thom@linux.com> wrote:
> Actually, this rings a bell. =A0I think this may have been raised
> before, something to do with the delimiter being accepted as one of
> the order by values. =A0If this isn't really a bug, could someone
> mention it in the docs somewhere?

Oh, yeah.  I guess you need this:

select thing, string_agg(stuff, ',' order by stuff) from agg_test
group by thing;

Rather than this:

select thing, string_agg(stuff order by stuff, ',') from agg_test
group by thing;

It's all kinds of not obvious to me what the second one is supposed to
mean, but I remember this was discussed before.  Perhaps we need a
<note> somewhere about multi-argument aggregates.

--=20
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Thom Brown
Дата:
Сообщение: Re: string_agg delimiter having no effect with order by
Следующее
От: Fujii Masao
Дата:
Сообщение: In 8.2, shutdown wrongly caused automatic restart