The problem is
solved. It may be helpful for other text encoding newbies like me that many Windows Applications
(and the .NET classes by default) create a byte order mark (bom) when they save data in
utf-8 format. This bom is not accepted by the postgresql 8.4 copy command. The editor notepad++
for example can detect and remove the bom. Oliver From: Keller, Oliver hi all, since several days I
try to import some ascii data into my postgresql 8.4 (under Win Vista SP1)
database. I use the copy command
under pgAdmin III. This is some example data (from an UTF-8 encoded textfile): 1| 3.7200001E-01| 1.0000000E+00|S 2| 1.2400000E+00| 1.0000000E+01|S 3| 9.4199997E-01| 1.0000000E+02|S 4| 1.1200000E+00| 1.0000000E+03|S 5| 8.1800002E-01| 1.6667000E+02|M 6| 9.9400002E-01| 2.7780001E+01|H 7| 3.7200001E-01| 2.7779999E+02|H 8| 3.7200001E-01| 1.1570000E+02|D This is the table
structure: CREATE TABLE tableName
(
fs_id integer NOT NULL,
fs_sat real NOT NULL,
fs_hval real NOT NULL,
fs_hunit character(1) NOT NULL ); This is the copy
command: COPY tableName FROM
'C:/Users/postgres/Documents/import_tableName.txt' DELIMITERS '|'; When I execute it I
get the following error message (translated text): Error: invalid input
syntax for integer: »1« CONTEXT: COPY
tableName, row 1, column fs_id: »1« SQL state:22P02 psql tells me that the
client-encoding is utf-8: postgres=# \encoding UTF8 I don’t have this
problem with tables where no integers are in the first column. My question is now:
what's wrong? Where comes this blank in front of the 1 in the error message
from? Thank you very much
for any help! Oliver |