12

For some reason I cannot change the language of the error messages from PostgreSQL. I have tried to set the language inside the script for creating the schema in at the first line:

SET lc_messages TO 'en_US.UTF-8';

and I also did this, setting LC_MESSAGES to English but it didn't help. Yes, I restarted the service after changing the value.

enter image description here

Nothing seems to work. I am still getting my messages in German.

What else can I try?

Community
  • 1
  • 1
Stefan Falk
  • 23,898
  • 50
  • 191
  • 378
  • Apparently some users have had issues when using `SET lc_messages TO 'en_US.UTF-8';` did you try running this command as admin/sudo? – Haymaker Jan 06 '16 at 19:20
  • @Haymaker Yes, I think so. I am running the script out of my Eclipse which runs in admin mode. That shouldn't be the problem I guess. – Stefan Falk Jan 06 '16 at 19:24
  • I would say try running postgres from terminal as administrator and see if that changes anything. – Haymaker Jan 06 '16 at 19:25
  • Check that LANGUAGE environment variable is not set when you start your PostgreSQL server. Its value overrides any locale settings. – Egor Rogov Jan 07 '16 at 00:05
  • @EgorRogov I don't see a variable LANGUAGE under my environment variables. – Stefan Falk Mar 16 '16 at 20:13
  • I have `lc_messages = 'English_United States.1252'` in my `postgresql.conf` and that works just fine (together with the env var - not sure if I need both) –  Mar 16 '16 at 20:24
  • @a_horse_with_no_name Actually I don't have that file in `PostgreSQL\9.4\data`. I didn't change anything there. It's a clean installation. – Stefan Falk Mar 16 '16 at 20:29
  • You can't start Postgres without it. You can get the path of the file being used through: `select setting from pg_settings where name = 'config_file'` –  Mar 16 '16 at 20:58
  • @a_horse_with_no_name Since this was the issue there's a bounty worth 50 reputation waiting for you. The file was located on a different drive .. – Stefan Falk Mar 20 '16 at 13:12
  • BTW, the simplest setting to get original English error messages is `SET lc_messages = 'C'`. Effectively not using a locale, this works universally. – Erwin Brandstetter Mar 22 '16 at 13:32
  • @a_horse_with_no_name Are you going to provide the answer? – Stefan Falk Mar 23 '16 at 13:37

2 Answers2

5

if you have permission for access to $datadir\postgresql.conf, you change lc_messages parameter to 'English_United States.1252'.

After you must reload configuration.

My config settings is here;

#These settings are initialized by initdb, but they can be changed.

lc_messages = 'English_United States.1252' # locale for system error message strings

lc_monetary = 'English_United States.1252' # locale for monetary formatting

lc_numeric = 'English_United States.1252' # locale for number formatting

lc_time = 'English_United States.1252' # locale for time formatting

# default configuration for text search

default_text_search_config = 'pg_catalog.english'

Hasan BINBOGA
  • 794
  • 9
  • 19
0

Have you tried the following command?

initdb --locale=en_US --lc_messages=en_US

for details, please refer to http://www.postgresql.org/docs/9.0/static/locale.html

buqing
  • 925
  • 8
  • 25