Upgrade postgresql 10 -> 11 lc_collate problem


(Herman verschooten) #1

Using brew postgresql-upgrade-database fails because initdb is creating a database with en_US, instead of my locale.

The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.

Causing this error:

lc_collate values for database “postgres” do not match: old “nl_BE.UTF-8”, new “en_US.UTF-8”

I had to change the script and add --locale nl_BE.UTF-8 to the initdb line.


(Marin) #2

Could you be a little more specific on how this was done? Is the script installed on OSX? If it is, I am unable to find it on my mac.
Thanks!


(Herman verschooten) #3

It is located in a subfolder of /usr/local/Homebrew. I believe it was: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/cmd/brew-postgresql-upgrade-database.rb


(Marin) #4

Thanks for your help, the complete location you specified is correct.
Also, I would like to point out on how I changed my line for initdb:
system "#{bin}/initdb", "--no-locale", "-E=UTF8", "--lc-ctype=UTF-8", "#{var}/postgres"

I needed to specify two more parameters, the encoding and lc_ctype.


(Herman verschooten) #5

Probably because you specified --no-locale


(Andistern) #6

Thanks Herman for pointing out all this, saved me a lot of time this morning!
Should there perhaps a bug report filed ( as obviously other locales and collations are used in non US Countries)?