Search code examples
databasepostgresqlmacoslocalepsql

Set LC_COLLATE and LC_CTYPE on MacOs


I am trying to create a new database in postgresql with the following script.

CREATE DATABASE test
OWNER dba
TEMPLATE template0
ENCODING 'UTF-8'
LC_COLLATE 'nb_NO.UTF-8'
LC_CTYPE 'nb_NO.UTF-8'

When I run the script I get the following error:

ERROR:  invalid locale name: "nb_NO.UTF-8"

I can see that on Linux Based Systems there is a command called

locale-gen

But I can't find something similar for macOS.


Solution

  • From this ERROR, it is clear that Locale nb_NO.UTF-8 is not present on your MacOS.

    And for the command to check the locales on you macOS please use the below command.

    locale -a