integer import problem

From: "Keller, Oliver" <kellero(at)uni-mainz(dot)de>
To: "'pgsql-admin(at)postgresql(dot)org'" <pgsql-admin(at)postgresql(dot)org>
Subject: integer import problem
Date: 2009-09-10 09:37:15
Message-ID: 9050BAD35AE6104D91C1984F32EB0C4601AFF8FADBCB@EXCHANGE-01.zdv.uni-mainz.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

Browse pgsql-admin by date

  From Date Subject
Next Message Nicolas Michel 2009-09-10 13:38:24 Changing character set of existing databases
Previous Message Michael Monnerie 2009-09-10 08:37:20 type cast from bytea to varchar or whatever