Re: select a list of column values directly into an array - Mailing list pgsql-general

From Yeb Havinga
Subject Re: select a list of column values directly into an array
Date
Msg-id 4C4EDD4B.9020907@gmail.com
Whole thread Raw
In response to Re: select a list of column values directly into an array  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List 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}
>
Or select ARRAY (select col1 from foo);



pgsql-general by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: select a list of column values directly into an array
Next
From: Yeb Havinga
Date:
Subject: Re: select a list of column values directly into an array