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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [GENERAL] How do I insert and update into a table of arrays ofcomposite types via a select command?
Дата
Msg-id CAKFQuwZmKQJ+1g0rOWwtkhLEui0Y0WLjg=qVhXeko3kNbBP6-g@mail.gmail.com
обсуждение исходный текст
Ответ на 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>)
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: Celia McInnis
Дата:
Сообщение: Re: [GENERAL] How do I insert and update into a table of arrays ofcomposite types via a select command?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] How do I insert and update into a table of arrays of composite types via a select command?