Re: ERROR: invalid input syntax for integer: SQL state: 22P02 - Mailing list pgsql-novice

From Tom Lane
Subject Re: ERROR: invalid input syntax for integer: SQL state: 22P02
Date
Msg-id 8561.1325441286@sss.pgh.pa.us
Whole thread Raw
In response to ERROR: invalid input syntax for integer: SQL state: 22P02  (avalon78 geek <avalon78.gr@gmail.com>)
List pgsql-novice
avalon78 geek <avalon78.gr@gmail.com> writes:
> i issue the following sql command
> COPY cust
>  FROM 'C:\Program Files\PostgreSQL\9.1\customers.txt'
> WITH DELIMITER ';'  ;

> and i get an error
> ERROR: invalid input syntax for integer: "13"
> SQL state: 22P02

That looks like you have a Unicode BOM marker at the start of the file.
There are some (pretty broken IMO) Windows editors that add such behind
your back in order to mark a text file as being text ... of course, it's
not plain text anymore, and BOM is useless/illegal in UTF-8 anyway, but
standards compliance was never Microsoft's strong suit.

Save the file with some other editor.

            regards, tom lane

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to declare a variable in a postgresql query in sql language ?
Next
From: Craig Barnes
Date:
Subject: Re: ERROR: invalid input syntax for integer: SQL state: 22P02