From: Tom Lane <tgl@sss.pgh.pa.us>
To: ganuri@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14265: inserting multiple rows via array notation gives error
Date: Wed, 27 Jul 2016 14:51:20 -0400
Message-ID: <9747.1469645480@sss.pgh.pa.us> (raw)
In-Reply-To: <20160727005725.7438.26021@wrigleys.postgresql.org>
References: <20160727005725.7438.26021@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, ganuri@gmail.com
Subject: Re: BUG #14265: inserting multiple rows via array notation gives error
In-Reply-To: <9747.1469645480@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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