Re: Syntax error in a large COPY - Mailing list pgsql-general

From Tom Lane
Subject Re: Syntax error in a large COPY
Date
Msg-id 24280.1194372840@sss.pgh.pa.us
Whole thread Raw
In response to Syntax error in a large COPY  (Reg Me Please <regmeplease@gmail.com>)
Responses Re: Syntax error in a large COPY  (Reg Me Please <regmeplease@gmail.com>)
List pgsql-general
Reg Me Please <regmeplease@gmail.com> writes:
> At a certain point I get an error telling about a
> "invalid input syntax for type numeric"
> The incriminated line number is the last one (the one containing the \.).
> Is there a way to know which line is really malformed?

Why do you think the report is inaccurate?

I can reproduce this by putting a few spaces in front of \., for
instance.

regression=# create table foo(f1 numeric);
CREATE TABLE
regression=# copy foo from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> 123
>> \.
regression=# copy foo from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>>   \.
>> \.
ERROR:  invalid input syntax for type numeric: "  "
CONTEXT:  COPY foo, line 1, column f1: "  "
regression=#

As the psql prompt mentions, \. has to be alone on a line.

            regards, tom lane

pgsql-general by date:

Previous
From: Reg Me Please
Date:
Subject: Syntax error in a large COPY
Next
From: Reg Me Please
Date:
Subject: Re: Syntax error in a large COPY