BUG #14265: inserting multiple rows via array notation gives error
The following bug has been logged on the website:
Bug reference: 14265
Logged by: Nuri Boardman
Email address: ganuri@gmail.com
PostgreSQL version: 9.4.5
Operating system: Windows 7 - 64
Description:
given a table:
create table test ( testarray int[]);
this completes as i would expect
insert into test (testarray[1], testarray[2]) values (1,2)
this gives an error
insert into test (testarray[1], testarray[2]) values (1,2),(3,4)
ERROR: multiple assignments to same column "testarray"
I'm not sure if this is supported or not, as i didn't see any documentation
about it.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/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
/messages/by-id/9578.1469645245@sss.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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs