From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Rich Shepard <rshepard@appl-ecosys.com>
To: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: Multi-row insert: error at terminal row.
Date: Thu, 29 Oct 2020 09:45:37 -0700
Message-ID: <a4d5d34a-63fb-b0f5-024c-0deeb12c0dad@aklaver.com> (raw)
In-Reply-To: <alpine.LNX.2.20.2010290932220.522@salmo.appl-ecosys.com>
References: <alpine.LNX.2.20.2010290837410.522@salmo.appl-ecosys.com>
<712da077-deec-6787-2ef0-3e668acfbc17@gmail.com>
<alpine.LNX.2.20.2010290857010.522@salmo.appl-ecosys.com>
<6FE34808-28CE-4550-9BC4-A70D91503D2C@gmail.com>
<alpine.LNX.2.20.2010290906590.522@salmo.appl-ecosys.com>
<23EFF7D8-D708-4F5F-826C-A7FB0F7C265A@gmail.com>
<alpine.LNX.2.20.2010290932220.522@salmo.appl-ecosys.com>
On 10/29/20 9:35 AM, Rich Shepard wrote:
> On Thu, 29 Oct 2020, Paul Förster wrote:
>
>> insert ...
>> (
>> (v1, v2, v3),
>> (v4, v5, v6),
>> (v7, v8, v9) <= this is the bracket pair that Emacs shows as
>> matching.
>> ); <= this is the missing bracket.
>
> Paul/Adrian/Tom:
>
> First thing I did was look at the postgres 12 manual. On page 155 I see:
>
> You can insert multiple rows in a single command:
> INSERT INTO products (product_no, name, price) VALUES
> (1, 'Cheese', 9.99),
> (2, 'Bread', 1.99),
> (3, 'Milk', 2.99);
>
> Which is what I have. There are no extra parentheses enclosing multiple
> rows
> of VALUES. But, adding them makes no difference: same error reported.
If you did something like:
INSERT INTO products (product_no, name, price) VALUES
(
(1, 'Cheese', 9.99),
(2, 'Bread', 1.99),
(3, 'Milk', 2.99)
);
then you should have gotten a different error. Something like:
ERROR: column "product_no" is of type integer but expression is of type
record
I'm going to say the issue is more like what David posted, an escaping
problem in the data. Not sure how many rows you are dealing with, but it
might be helpful to break them down into smaller batches to isolate the
problem.
>
> Thanks,
>
> Rich
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, rshepard@appl-ecosys.com
Subject: Re: Multi-row insert: error at terminal row.
In-Reply-To: <a4d5d34a-63fb-b0f5-024c-0deeb12c0dad@aklaver.com>
References: <alpine.LNX.2.20.2010290837410.522@salmo.appl-ecosys.com> <712da077-deec-6787-2ef0-3e668acfbc17@gmail.com> <alpine.LNX.2.20.2010290857010.522@salmo.appl-ecosys.com> <6FE34808-28CE-4550-9BC4-A70D91503D2C@gmail.com> <alpine.LNX.2.20.2010290906590.522@salmo.appl-ecosys.com> <23EFF7D8-D708-4F5F-826C-A7FB0F7C265A@gmail.com> <alpine.LNX.2.20.2010290932220.522@salmo.appl-ecosys.com> <a4d5d34a-63fb-b0f5-024c-0deeb12c0dad@aklaver.com>
* 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