Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connect to postgresql database with different locale

I have some old database that I need to connect to (postgres 9.1). I have no problem to start server with

pg_ctl start -D D:\datadir\pgdata\data -w

but when I try to connect, it gives:

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.

new version of postgres would not start server (incompatible data version). I'm using windows 10, with postgres 9.1 binaries.

How would it be possible to connect, migrate, upgrade such database, to access it data?

like image 378
Dainius Avatar asked Jul 26 '15 11:07

Dainius


1 Answers

I had this issue today. Except my error was for en_GB:

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

I solved it with

localedef -f UTF-8 -i en_GB en_GB.UTF-8

You will need to change it depending on your language setting.

Restart the postgresql service after.

like image 190
Karim Tabet Avatar answered Oct 05 '22 10:10

Karim Tabet