Thread: Invalid byte sequence

Invalid byte sequence

From
Robert Fitzpatrick
Date:
I am getting the following error when trying to migrate a db from
8.4.0/FreeBSD 7.1 to 9.0.1/FreeBSD 8.1, both are VMware virtual machines
with FreeBSD amd64...

> data1# psql -U pgsql template1 < /data/maia.sql
> <snip>
> template1 < /data/incoming.sql
> ERROR:  invalid byte sequence for encoding "UTF8": 0xe93532
> CONTEXT:  COPY awl, line 7884

I checked the build options for both pgsql port installations and found
only difference being WITH_INTDATE=true in the destination server. I
checked the line in the source file created by pg_restore and see no
date involved in the record...

> data1# head -7884 /data/incoming.sql | tail -1
> vscan   gevalia@prolongedinspire.com    216.188 2       25.838000000000001

pg_restore -l on the source file dump file...

; Archive created at Thu Dec  9 03:03:27 2010
;     dbname: maia
;     TOC Entries: 161
;     Compression: -1
;     Dump Version: 1.11-0
;     Format: CUSTOM
;     Integer: 4 bytes
;     Offset: 8 bytes
;     Dumped from database version: 8.4.0
;     Dumped by pg_dump version: 8.4.0

Is it the WITH_INTDATE option and I should rebuild or something else
causing this error?

--Robert

Re: Invalid byte sequence

From
Vick Khera
Date:
Was the original DB in UTF8 encoding?  You need to make sure the new
DB is created with the same encoding as the original, or do the
necessary translations using something like iconv.