天天看點

PostgreSQL logs messages in a different language than English

https://access.redhat.com/solutions/4369881

 SOLUTION 已驗證 - 已更新 2019年八月23日22:54 - 

English 

環境

  • 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.

Raw

# 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
           

診斷步驟

# 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           

繼續閱讀