Re: BUG #14265: inserting multiple rows via array notation gives error - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14265: inserting multiple rows via array notation gives error
Date
Msg-id 9747.1469645480@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14265: inserting multiple rows via array notation gives error  (ganuri@gmail.com)
List 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 by date:

Previous
From: jbristow@adaptivecomputing.com
Date:
Subject: BUG #14266: rhel-6Client yum repository is missing
Next
From: nilesoien@gmail.com
Date:
Subject: BUG #14267: ecpg bug causes hanging for certain data types