https://access.redhat.com/solutions/4369881
SOLUTION 已验证 - 已更新 2019年八月23日22:54 -
环境
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
问题
- PostgreSQL logs messages in a different language than English.
- PostgreSQL logs messages in local format, that is different from English.
决议
Change lc_
values in postgresql.conf
to the default value of en_US.UTF-8
and restart PostgreSQL.
# grep lc_ /var/lib/pgsql/data/postgresql.conf
lc_messages = 'en_US.UTF-8' # locale for system error message
lc_monetary = 'en_US.UTF-8' # locale for monetary formatting
lc_numeric = 'en_US.UTF-8' # locale for number formatting
lc_time = 'en_US.UTF-8' # locale for time formatting
# systemctl restart postgresql.service
根源
To initialize a PostgreSQL database, initdb
command has to be executed. This command uses local locale settings to configure the database. If local locale is set to other language than English, and if PostgreSQL has been translated to that language, messages will be logged in that other language.
initdb
accepts locale
parameter to initialize the database with a locale different to the system's one.
# initdb --locale en_US.UTF-8
诊断步骤
Check lc_
settings in postgresql.conf
.
# grep lc_ /var/lib/pgsql/data/postgresql.conf
lc_messages = 'es_ES.utf8' # locale for system error message
lc_monetary = 'es_ES.utf8' # locale for monetary formatting
lc_numeric = 'es_ES.utf8' # locale for number formatting
lc_time = 'es_ES.utf8' # locale for time formatting