Resetting a database with a specific encoding and attempting to restore it to another database with a different encoding can lead to data corruption. Data encoding must be set before any data is inserted into the database.
Check this : When copying any other database, the encoding and locale parameters cannot be changed from the settings of the original database, as this can lead to data corruption.
And this : Some databases must have their own values ββwhen creating the database. You can use different settings for different databases, but after creating the database, you can no longer change them for this database. LC_COLLATE and LC_CTYPE are these categories. They affect the sort order of indexes, so they must be fixed, or indexes on text columns become damaged. (But you can mitigate this limitation by using mappings, as described in Section 22.2.) The default values ββfor these categories are determined when initdb is run, and these values ββare used when creating new databases, unless otherwise specified in the CREATE DATABASE command.
I would rather rebuild everything from the start with the correct local encoding on your debian OS, as described here :
su root
Reconfigure your local settings:
dpkg-reconfigure locales
Choose your language (for example, for French in Switzerland: fr_CH.UTF8)
Remove and clean postgresql correctly:
apt-get --purge remove postgresql\* rm -r /etc/postgresql/ rm -r /etc/postgresql-common/ rm -r /var/lib/postgresql/ userdel -r postgres groupdel postgres
Reinstall postgresql:
aptitude install postgresql-9.1 postgresql-contrib-9.1 postgresql-doc-9.1
Now any new database will be automatically created with the correct encoding, LC_TYPE (character classification) and LC_COLLATE (string sorting order).
Douglas Dec 31 '14 at 12:30 2013-12-31 12:30
source share