pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14265: inserting multiple rows via array notation gives error
2+ messages / 2 participants
[nested] [flat]

* BUG #14265: inserting multiple rows via array notation gives error
@ 2016-07-27 00:57 ganuri@gmail.com
  2016-07-27 18:51 ` Re: BUG #14265: inserting multiple rows via array notation gives error Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: ganuri@gmail.com @ 2016-07-27 00:57 UTC (permalink / raw)
  To: pgsql-bugs

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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #14265: inserting multiple rows via array notation gives error
  2016-07-27 00:57 BUG #14265: inserting multiple rows via array notation gives error ganuri@gmail.com
@ 2016-07-27 18:51 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2016-07-27 18:51 UTC (permalink / raw)
  To: ganuri@gmail.com; +Cc: 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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-07-27 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-07-27 00:57 BUG #14265: inserting multiple rows via array notation gives error ganuri@gmail.com
2016-07-27 18:51 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox