If creating a postgres database on just upgraded Ubuntu box to the 8.10 release
postgres@somehost$ createdb -E latin1 dbname
You get the error
ERROR: encoding LATIN1 does not match server’s locale es_ES.UTF-8
DETAIL: The server’s LC_CTYPE setting requires encoding UTF8.
You have to follow some steps to create the database You need:
# /etc init.d/postgresql stop
# mv /var/lib/postgresql/8.3/main /var/lib/postgresql/8.3/main.old
# mkdir /var/lib/postgresql/8.3/main
# chown postgres:postgres /var/lib/postgresql/8.3/main
# chmod 700 /var/lib/postgresql/8.3/mainThen as postgres user:
postgres@somehost $ /usr/lib/postgresql/8.3/bin/initdb -D /var/lib/postgresql/8.3/main –locale=es_ES.ISO88591 –encoding=Latin1 –lc-collate=Latin1
And finally as root:
# ln -s /etc/postgresql-common/root.crt root.crt
# ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem server.crt
# ln -s /etc/ssl/private/ssl-cert-snakeoil.key server.key
# /etc init.d/postgresql start
thanks to Julio Cesar.