Обсуждение: ERROR: invalid input syntax for integer

Поиск
Список
Период
Сортировка

ERROR: invalid input syntax for integer

От
Jonatan Reiners
Дата:
Hello Folks,
we had this topic before on this list.

This is is a new error with the same message.

I tried to copy from a text file and a csv file with the same issue.

the integer values are not quoted in the file

source:
3192;95956;48901;1018;NULL;Мурзилка;3;2006-

\copy abos from '/Users/jreiners/Downloads/test.csv' (format csv, delimiter ';', encoding 'utf-8');
ERROR:  invalid input syntax for integer: "3192"


Source:
3192 95956 48901 1018 NULL Мурзилка 3 2006-

\copy abos from '/Users/jreiners/Downloads/text.txt' (encoding 'utf-8', null 'NULL');
ERROR:  invalid input syntax for integer: "3192"

I couldn't find any clues. Please help me.

Kind regards,
Jonatan

Re: ERROR: invalid input syntax for integer

От
Steve Crawford
Дата:
On 05/30/2012 06:21 AM, Jonatan Reiners wrote:
> Hello Folks,
> we had this topic before on this list.
>
> This is is a new error with the same message.
>
> I tried to copy from a text file and a csv file with the same issue.
>
> the integer values are not quoted in the file
>
> source:
> 3192;95956;48901;1018;NULL;Мурзилка;3;2006-
>
> \copy abos from '/Users/jreiners/Downloads/test.csv' (format csv,
> delimiter ';', encoding 'utf-8');
> ERROR:  invalid input syntax for integer: "3192"
>
>
> Source:
> 319295956489011018NULLМурзилка32006-
>
> \copy abos from '/Users/jreiners/Downloads/text.txt' (encoding
> 'utf-8', null 'NULL');
> ERROR:  invalid input syntax for integer: "3192"
>
> I couldn't find any clues. Please help me.
>
Is this the first line in the file? Have you verified the file and made
absolutely sure there are no invisible characters. Use something like
xxd to examine the file before checking anything else. I'm not sure how
PostgreSQL will work if there is a byte-order-mark at the beginning of a
file and don't have time to test that at the moment.

Cheers,
Steve


Re: ERROR: invalid input syntax for integer

От
Jonatan Reiners
Дата:
you were right. It was the BOM.
Thanks a lot.

On Wed, May 30, 2012 at 8:18 PM, Steve Crawford <scrawford@pinpointresearch.com> wrote:
On 05/30/2012 06:21 AM, Jonatan Reiners wrote:
Hello Folks,
we had this topic before on this list.

This is is a new error with the same message.

I tried to copy from a text file and a csv file with the same issue.

the integer values are not quoted in the file

source:
3192;95956;48901;1018;NULL;Мурзилка;3;2006-

\copy abos from '/Users/jreiners/Downloads/test.csv' (format csv, delimiter ';', encoding 'utf-8');
ERROR:  invalid input syntax for integer: "3192"


Source:
319295956489011018NULLМурзилка32006-

\copy abos from '/Users/jreiners/Downloads/text.txt' (encoding 'utf-8', null 'NULL');
ERROR:  invalid input syntax for integer: "3192"

Is this the first line in the file? Have you verified the file and made absolutely sure there are no invisible characters. Use something like xxd to examine the file before checking anything else. I'm not sure how PostgreSQL will work if there is a byte-order-mark at the beginning of a file and don't have time to test that at the moment.