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

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Multi-row insert: error at terminal row.
Дата
Msg-id a4d5d34a-63fb-b0f5-024c-0deeb12c0dad@aklaver.com
обсуждение исходный текст
Ответ на Re: Multi-row insert: error at terminal row.  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Multi-row insert: error at terminal row.  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
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



В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Multi-row insert: error at terminal row.
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Multi-row insert: error at terminal row.