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

Поиск
Список
Период
Сортировка
От Yeb Havinga
Тема Re: select a list of column values directly into an array
Дата
Msg-id 4C4EDD11.2090300@gmail.com
обсуждение исходный текст
Ответ на Re: select a list of column values directly into an array  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-general
A. Kretschmer wrote:
> In response to Gauthier, Dave :
>
>> Is there a way to select a list of column values directly into an array?
>>
>>
>>
>> create table foo (col1 text);
>>
>> insert into foo (col1) values (?aaa?),(?bbb?),(?ccc?),(?ddd?),(?eee?);
>>
>>
>>
>> I?d like to load up an array with {aaa,bbb,ccc,ddd,eee}, prefferably with a
>> single select statement.
>>
>
> test=*# select array_agg(col1) from foo;
>        array_agg
> -----------------------
>  {aaa,bbb,ccc,ddd,eee}
>
/me scratches on head - wasn't there something with array?

select ARRAY (select col1 from foo);



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

Предыдущее
От: Yeb Havinga
Дата:
Сообщение: Re: select a list of column values directly into an array
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: select a list of column values directly into an array