BUG #5164: COPY command: invalid byte sequence 0x80
BUG #5164: COPY command: invalid byte sequence 0x80
От:
"Bogdan Mihaila" <bm2004mvc@yahoo.com>
Дата:
The following bug has been logged online:
Bug reference: 5164
Logged by: Bogdan Mihaila
Email address: bm2004mvc@yahoo.com
PostgreSQL version: 8.1 and 8.3
Operating system: Linux
Description: COPY command: invalid byte sequence 0x80
Details:
Hello!
I searched the internet for this problem, but I didn't find an answer.
Please help me.
I make a COPY TO command (in a 8.1 version, under Linux) for a table that
contains text in the UTF-8 encoding. The command is:
set client_encoding = 'utf8';
DROP TABLE "acte1";
CREATE TEMP TABLE "acte1" AS
SELECT * FROM "Oficiale"."acte" WHERE id = 57502;
COPY "acte1" TO '/home/bogdanm/eugen.copy';
Then I make a COPY FROM (in a 8.3 version,under the same Linux machine as
above) like this:
set client_encoding = 'utf8';
copy "Oficiale"."acte" from '/home/bogdanm/eugen.copy'
It works!
But, where I specify the interval like this:
WHERE id > 57500 and id < 57600;
it doesn't work, saying:
ERROR: invalid byte sequence for encoding "UTF8": 0x80
HINT: This error can also happen if the byte sequence does not match the
encoding expected by the server, which is controlled by "client_encoding".
CONTEXT: COPY acte, line 51
Why is that? The second range obviously contains the first...
Thanks very much in advance,
BogdanRe: BUG #5164: COPY command: invalid byte sequence 0x80
От:
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Дата:
Bogdan Mihaila wrote: > ERROR: invalid byte sequence for encoding "UTF8": 0x80 > HINT: This error can also happen if the byte sequence does not match the > encoding expected by the server, which is controlled by "client_encoding". > CONTEXT: COPY acte, line 51 There is a byte sequence that's invalid for UTF-8 on line 51 in the dump file. I believe 8.3 is stricter about rejecting invalid UTF-8 strings than previous versions, so it's possible that you had a garbled character in the 8.1 database, which throws an error when copied into a 8.3 server. You need to fix the invalid character either in the dump file or in the 8.1 database. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com