%expand%
gunzip -c dumpall.gz | iconv | sudo -u postgres psql > restore.errs 2>&1
Miraculously, iconv worked without options, cleaning up version incompatibilities, while maintaining all the data... even the funny French city names.
If you're changing encodings while also upgrading, that's fine too. iconv takes a "from" and "to" argument, so log in to the source db and destination db, and use:
SHOW client_encoding;
Then use the results as the "-f FROM" and "-t TO" arguments to iconv. No conversion is perfect, but iconv seems to do as good a job as possible.
}))
| Bracing against the wind | |
| www.documentroot.com |
|
Tuesday, December 03, 2013
UTF8 Encoding and Postgres Dump
gunzip -c dumpall.gz | iconv | sudo -u postgres psql > restore.errs 2>&1
Miraculously, iconv worked without options, cleaning up version incompatibilities, while maintaining all the data... even the funny French city names.
If you're changing encodings while also upgrading, that's fine too. iconv takes a "from" and "to" argument, so log in to the source db and destination db, and use:
SHOW client_encoding;
Then use the results as the "-f FROM" and "-t TO" arguments to iconv. No conversion is perfect, but iconv seems to do as good a job as possible.
[View/Post Comments] [Digg] [Del.icio.us] [Stumble] |
|
Bloghop:
|
Blogarama
|
Technorati
|
Blogwise