What happens to postgresql initdb? Why is the `UTF-8` encoding not applicable?

I am using PostgreSQL 9.1. UTF8 default forced encoding attempt.

This is what I do.

service postgresql initdb -E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype=locale='en_US.UTF-8';

Although the initialization process continues without any problems,

a \lprompt psqlcontains details.

                         List of databases
   Name    |  Owner   |Encoding  | Collate | Ctype |   Access privileges   
-----------+----------+----------+---------+-------+-----------------------
  postgres | postgres | LATIN1 | en_US | en_US| 

Why is encoding UTF-8not used?

+6
source share
2 answers

It looks like you are calling initdb through an OS runlevel script. This script may not pass parameters. Better try running initdb directly, you will need to follow these steps, starting with the root account and assuming that the OS user account for the database is postgres.

mkdir <your data dir>
chown postgres <your data dir>
su postgres
initdb --pgdata=<your data dir> -E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'
+11

Debian PostgreSQL initdb i.e., . , . (, initdb), :

Take root privileges.
Run the following command:



 pg_dropcluster --stop <version> main

For example:

pg_dropcluster --stop 8.3 main

Run the initdb with your options. For example:

pg_createcluster --locale de_DE.UTF-8 --start 8.3 main

!

, , , . . PostgreSQL, ( ).

+1

All Articles