The following bug has been logged online:
Bug reference: 5944
Logged by: Nathan Davalos
Email address: n.davalos@sharedmarketing.com
PostgreSQL version: 9
Operating system: Windows XP/2003
Description: COPY FROM doesn't work with international characters
Details:
I'm trying to load a tab delimited text file with COPY FROM under version
9.
create table tmpintermediate (
AcNumber character varying(20),
AcName character varying(50));
SET CLIENT_ENCODING TO 'WIN1251';
copy tmpintermediate from 'thefile.txt';
Sample contents of thefile:
230002 Alto Desempeño, S.A. De C.V.
When using WIN1251 or WIN1252 I get nothing in the second field, it just
ignores the data. Same thing for LATIN-1.
When using UTF8 for client encoding I get this message:
ERROR: invalid byte sequence for encoding "UTF8": 0xf16f2c20
CONTEXT: COPY tmpintermediate , line 1
Not sure what the problem is, I assumed encoding the database as UTF8 would
just take any character. Inserting the data with an insert statement works
perfectly normal. Is it something I'm doing wrong with COPY FROM?
The database is UTF8, in 8.3 we were using WIN1252 for the database
encoding, but when we migrated to 8.4 everything was forced to UTF8
regardless of what the locale was specified during install using pg_dumpall
to migrate the data, so I just left things as UTF8. Not sure how to proceed
with this one. We create all our databases using a customized template
datatabase (we leave the ones that install with postgresql intact and
untouched).
The copy commands are being issued by pgadmin3 if that makes any difference.
That and we use MicroOlap's PosgresDAC components for Delphi.