1

Using the Windows PostgreSQL terminal to connect to the same database, we are getting responses in different languages on 2 different machines (one in Chinese, one in English). I've not been able to work out what is different about the setup of these 2 machines to fix it. Of specific note, several questions (here and here) seem to indicate that the LC_MESSAGES setting is what needs to be changed, except both machines are set to en_GB.UTF-8.

Machine 1:

show LC_MESSAGES;

 lc_messages 
-------------
 en_GB.UTF-8
(1 row)

Machine 2:

show LC_MESSAGES;

lc_messages 
-------------
en_GB.UTF-8
(1 行记录)

There is clearly something else involved in deciding what language messages from Postgres are returned in, but I've been unable to figure out what.


Update: While Lauenz Albe's answer explains why what I've tried so far has failed, I've still be unable to find any documentation or advice which deals with how language in PSQL is set, or how to fix it.

littlefeltfangs
  • 396
  • 2
  • 17

2 Answers2

1

Set the LANG environment variable, exemplary batch file:

@echo off
set PGDATABASE=my_database
set PGUSER=my_user
set PGPASSWORD=my_password
set LANG=C
psql -f %1
klin
  • 112,967
  • 15
  • 204
  • 232
0

lc_messages determines the language for messages from the server.

The (1 行记录) you see is written by psql, and determined by the locale environment of psql.

To change this, you'd have to change the locale environment of your Windows session. Not sure how that is done.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263