Re: Multi-row insert: error at terminal row.

From: Paul Förster <paul(dot)foerster(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Rich Shepard <rshepard(at)appl-ecosys(dot)com>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Multi-row insert: error at terminal row.
Date: 2020-10-29 16:31:11
Message-ID: 2B8E205A-354A-4C8B-9D8A-B06E86A269B6@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi David,

> On 29. Oct, 2020, at 17:21, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Thu, Oct 29, 2020 at 9:16 AM Paul Förster <paul(dot)foerster(at)gmail(dot)com> wrote:
> But I guess that Emacs shows the matching closing bracket at the beginning of the line, which matches that single tuple. But you also need a closing bracket for the set of tuples like this:
>
> 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.
>
>
> Except that isn't valid INSERT statement syntax. You are missing "values" and there is no enclosing parens:
>
> INSERT INTO tbl (i) VALUES (1), (2), (3); --this is perfectly valid
>
> That said seeing the first few rows, in addition to the last few, would help.

sorry, I didn't check. My point was that there is a mismatch between a closing parent and an initial opening parent somewhere even if Emacs shows the last parent as matching the last opening parent.

So, you are right of course.

postgres=# create table t1(v1 int, v2 int, v3 int);
CREATE TABLE
postgres=# insert into t1(v1, v2, v3)
values
(1, 2, 3),
(4, 5, 6),
(7, 8, 9);
INSERT 0 3

Cheers,
Paul

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2020-10-29 16:35:42 Re: Multi-row insert: error at terminal row.
Previous Message Rich Shepard 2020-10-29 16:30:58 Re: Multi-row insert: error at terminal row. [RESOLVED]