Re: Review: listagg aggregate

Поиск
Список
Период
Сортировка
От Takahiro Itagaki
Тема Re: Review: listagg aggregate
Дата
Msg-id 20100128114706.987A.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответ на Re: Review: listagg aggregate  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Review: listagg aggregate  ("David E. Wheeler" <david@kineticode.com>)
Re: Review: listagg aggregate  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Review: listagg aggregate  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> wrote:

> with actualised oids

I'm checking the patch for commit, and have a couple of comments.

* I think we cannot cache the delimiter at the first call.
  For example,
    SELECT string_agg(elem, delim)
      FROM (VALUES('A', ','), ('B', '+'), ('C', '*')) t(elem, delim);
  should return 'A+B*C' rather than 'A,B,C'.

* Can we use StringInfo directly as the aggregate context instead of
  StringAggState? For the first reason, we need to drop 'delimiter' field
  from struct StringAggState. Now it has only StringInfo field.

* We'd better avoiding to call text_to_cstring() for delimitors and elements
  for performance reason. We can use appendBinaryStringInfo() here.

My proposal patch attached.

Also, I've not changed it yet, but it might be considerable:

* Do we need better names for string_agg1_transfn and string_agg2_transfn?
  They are almost "internal names", but we could have more
  like string_agg_with_sep_transfn.

Comments?

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center


Вложения

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: make everything target
Следующее
От: "David E. Wheeler"
Дата:
Сообщение: Re: Review: listagg aggregate