使用不同的语言环境连接到postgresql数据库

Dai*_*ius 9 postgresql locale windows-10

我有一些我需要连接的旧数据库(postgres 9.1).我没有问题启动服务器

pg_ctl start -D D:\datadir\pgdata\data -w
Run Code Online (Sandbox Code Playgroud)

但是当我尝试连接时,它会给出:

psql -U postgres -p 15432
psql: FATAL:  database locale is incompatible with operating system
DETAIL:  The database was initialized with LC_COLLATE "Norwegian (Bokmål)_Norway.1252",  which is not recognized by setlocale().
HINT:  Recreate the database with another locale or install the missing locale.
Run Code Online (Sandbox Code Playgroud)

新版本的postgres无法启动服务器(不兼容的数据版本).我正在使用Windows 10,带有postgres 9.1二进制文件.

如何连接,迁移,升级此类数据库以访问其数据?

Kar*_*bet 7

我今天有这个问题。除非我的错误是针对en_GB:

The database was initialized with LC_COLLATE "en_GB.UTF-8",  which is not recognized by setlocale().
Run Code Online (Sandbox Code Playgroud)

我解决了

localedef -f UTF-8 -i en_GB en_GB.UTF-8
Run Code Online (Sandbox Code Playgroud)

您将需要根据您的语言设置进行更改。

之后重新启动postgresql服务。