I'm using pg_dump and pg_restore to move a schema from one Postgresql 9.5 server to another. On the destination server:
$ pg_dump -h source.example.com -n my_schema -v --no-owner -F c -f my_schema.dump perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_CTYPE = "UTF-8", LANG = (unset) are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). ... pg_dump: saving encoding = UTF8 (dump completes with no other errors or warnings) $ pg_restore -h 127.0.0.1 -e -v --no-owner -d my_db my_schema.dump ... perl: warning: Falling back to the standard locale ("C"). ... pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 2211; 0 6549333 TABLE DATA mention chicken pg_restore: [archiver (db)] COPY failed for table "mention": ERROR: invalid byte sequence for encoding "UTF8": 0xcd 0x2e
Any idea on how to solve this issue? What I want is an exact binary copy of the data. There seems to be some encoding problem which makes me nervous, since what is restored may not be exactly the same as the dump, even if I don't get any errors.