Re: select a list of column values directly into an array

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: select a list of column values directly into an array
Дата
Msg-id AANLkTi=dua5s9vgXDJX70DPwJo+q09B8U1D8uDp6Z3i2@mail.gmail.com
обсуждение исходный текст
Ответ на Re: select a list of column values directly into an array  (Derrick Rice <derrick.rice@gmail.com>)
Ответы Re: select a list of column values directly into an array  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
On Fri, Jul 30, 2010 at 10:34 AM, Derrick Rice <derrick.rice@gmail.com> wrote:
> Is it possible to use the ARRAY(select ...) syntax as a substitute for
> array_agg on versions of postgresql that don't have it? (8.2)  It works
> simply enough when only selecting a single column, but if I need to group by
> some other column, I'm not clear how I'd go about doing that.
>
> For example, write the following in ARRAY(select...) form.

yup...we've had array() for ages (I think -- see below).

now, you've always been able to do array aggregation in userland --
it's been in the docs as example since I can remember (see here:
http://www.postgresql.org/docs/8.2/static/xaggr.html)

The old school array_accum however is much slower than the newer
array_agg. (which in turn is just a tiny bit slower than array()
discounting grouping effects).  So you _definitely_ want to use
array() if you don't require aggregate grouping features in older
postgres versions.

hm. I looked for the documentation for array(select...) to figure out
exactly when it was introduced, couldn't find it.  Anyone know
if/where this is documented?

merlin

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

Предыдущее
От: Brad Nicholson
Дата:
Сообщение: Re: idle process & autovacuum
Следующее
От: Scott Frankel
Дата:
Сообщение: Re: PQescapeStringConn