I am using PostgreSQL 9.1. Trying to enforce UTF8 encoding as default.
This is what I am doing.
service postgresql initdb -E 'UTF-8' \
--lc-collate='en_US.UTF-8' \
--lc-ctype=locale='en_US.UTF-8';
Although the initilization process goes on without any problem,
a \l
at the psql
prompt gives there details.
List of databases
Name | Owner |Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------+-----------------------
postgres | postgres | LATIN1 | en_US | en_US |
Why is the UTF-8
encoding not getting enforced?
-E
as a shorthand. So the commend is legal.-E
. What happens if you call initdb directly?initdb
directly as a superuser. gave aninitdb: cannot be run as root Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.
error. After logging in as an unprivileged user I was able to initialize the db with the proper encoding.