Re: How do I insert and update into a table of arrays of composite types via a select command?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Celia McInnis <celia(dot)mcinnis(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How do I insert and update into a table of arrays of composite types via a select command?
Date: 2017-10-25 21:21:55
Message-ID: CAKFQuwZmKQJ+1g0rOWwtkhLEui0Y0WLjg=qVhXeko3kNbBP6-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 25, 2017 at 2:16 PM, Celia McInnis <celia(dot)mcinnis(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-10-25 21:25:20 Re: How do I insert and update into a table of arrays of composite types via a select command?
Previous Message Celia McInnis 2017-10-25 21:16:09 Re: How do I insert and update into a table of arrays of composite types via a select command?