Restore using pg_restore

We run daily dumps on our PostgreSQL databases. The command we use to dump the databases is:

pg_dump --blobs --compress=9 --format=c --verbose DBNAME --file=DUMPFILE.c

I recently had to restore one of the dumps to a different server and kept receiving the error:

ERROR: invalid byte sequence for encoding "UTF8": 0x93

I discovered that my original system had the database encoded as SQL_ASCII and the new system was encoding all new databases as UTF8. So I ran a create database with the proper encoding:

CREATE DATABASE newdbname WITH ENCODING 'SQL_ASCII';

Then restored the file using pg_restore:

pg_restore --dbname=newdbname DUMPFILE.c

Comments

Popular posts from this blog

Database, schema, and table sizes in Greenplum

Greenplum update with multiple tables

Show running queries on Postgresql/Greenplum