Populating an array from a select statement - Mailing list pgsql-novice

From John Gunther
Subject Populating an array from a select statement
Date
Msg-id 47B98686.2080109@bucksvsbytes.com
Whole thread Raw
In response to Re: accented characters migraine  ("Wright, George" <George.Wright@infimatic.com>)
Responses Re: Populating an array from a select statement
List pgsql-novice
What's the most straightforward way to populate an array from a select
statement? For example, using a fictional extension of SQL syntax, I'd like:

update users set emails=ARRAY[select email from address where userid=25]
where id=25;

So if user 25  has emails john@domain.com, john@gmail.com, and
john@yahoo.com in the address table,
select emails from user where id=25;
will return:
                                          emails
----------------------------------------------------------------
 {john@domain.com, john@gmail.com, and john@yahoo.com}


If there's no built in way to do this, I'd suggest it as a future feature.

pgsql-novice by date:

Previous
From: "Nicholas Hemley"
Date:
Subject: postgres 8.3 & ident authentication
Next
From: "A. Kretschmer"
Date:
Subject: Re: Populating an array from a select statement