Re: BUG #14265: inserting multiple rows via array notation gives error

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #14265: inserting multiple rows via array notation gives error
Дата
Msg-id 9747.1469645480@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #14265: inserting multiple rows via array notation gives error  (ganuri@gmail.com)
Список pgsql-bugs
ganuri@gmail.com writes:
> given a table:
> create table test ( testarray int[]);
> this gives an error
> insert into test (testarray[1], testarray[2]) values (1,2),(3,4)
> ERROR:  multiple assignments to same column "testarray"

Yeah, that ought to work, but fixing it is nontrivial --- see
https://www.postgresql.org/message-id/9578.1469645245%40sss.pgh.pa.us

In the meantime, it works to do it with INSERT/SELECT, eg

insert into test (testarray[1], testarray[2])
  select 1,2 union all select 3,4;

or even

insert into test (testarray[1], testarray[2])
  select * from (values (1,2),(3,4)) v;


            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: jbristow@adaptivecomputing.com
Дата:
Сообщение: BUG #14266: rhel-6Client yum repository is missing
Следующее
От: nilesoien@gmail.com
Дата:
Сообщение: BUG #14267: ecpg bug causes hanging for certain data types