I am 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 how to solve this issue? What I really want is an exact binary copy of the data. The fact that there seems to be some encoding problem makes me very nervous that what is restored might not be exactly the same as the dump, even if I don't get any errors.