Re: [GENERAL] How do I insert and update into a table of arrays ofcomposite types via a select command? - Mailing list pgsql-general

From David G. Johnston
Subject Re: [GENERAL] How do I insert and update into a table of arrays ofcomposite types via a select command?
Date
Msg-id CAKFQuwZmKQJ+1g0rOWwtkhLEui0Y0WLjg=qVhXeko3kNbBP6-g@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] How do I insert and update into a table of arrays ofcomposite types via a select command?  (Celia McInnis <celia.mcinnis@gmail.com>)
Responses Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wed, Oct 25, 2017 at 2:16 PM, Celia McInnis <celia.mcinnis@gmail.com> wrote:
Got it, finally...

insert into t_array select array[row((data_comp).*)::mytype[] from t_composite;

I'm not sure why I need (data_comp).* rather than some of the other things that I tried and failed with...


​The ​unusual set of parentheses are so the parser interprets data_comp is a column and not a table. Usually one write SELECT tbl.* FROM tbl so that is the assumed meaning of "name".*

David J.

pgsql-general by date:

Previous
From: Celia McInnis
Date:
Subject: Re: [GENERAL] How do I insert and update into a table of arrays ofcomposite types via a select command?
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?