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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ganuri(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14265: inserting multiple rows via array notation gives error
Date: 2016-07-27 18:51:20
Message-ID: 9747.1469645480@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

ganuri(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message nilesoien 2016-07-27 19:30:42 BUG #14267: ecpg bug causes hanging for certain data types
Previous Message jbristow 2016-07-27 18:17:40 BUG #14266: rhel-6Client yum repository is missing