This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert createdb's template to UTF8 | |
echo "UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';" | psql -U postgres | |
echo "drop database template1;" | psql -U postgres | |
echo "create database template1 with template = template0 encoding = 'UTF8';" | psql -U postgres | |
echo "update pg_database set datacl='{=c/postgres,postgres=CTc/postgres}' where datname='template1';" | psql -U postgres | |
echo "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';" | psql -U postgres | |
# export and reimport as UTF8 | |
pg_dump -U uniiverse --encoding utf8 mydatabase -f mydatabase_utf8.sql | |
createdb -U postgres -E utf8 mydatabase_utf8 |