Discussion:
PostgreSQL 9.4: initdb: invalid locale settings
o***@hushmail.com
2015-01-21 19:29:48 UTC
Permalink
Hello,

Why won't `postgresql-server-9.4.0` accept my locale? Just upgraded to 5.7 from 5.5. Whatever `postgresql-server` version was in 5.5 didn't have this problem.

% su _postgresql
% initdb -D /var/postgresql/data/
The files belonging to this database system will be owned by user "_postgresql".
This user must also own the server process.
initdb: invalid locale settings; check LANG and LC_* environment variables

`env` says `LC_ALL=en_US.UTF-8`, which according to `locale -a` does exist.

Thanks.

O.D.
frantisek holop
2015-01-21 20:33:16 UTC
Permalink
Post by o***@hushmail.com
Why won't `postgresql-server-9.4.0` accept my locale? Just upgraded to 5.7 from 5.5. Whatever `postgresql-server` version was in 5.5 didn't have this problem.
% su _postgresql
% initdb -D /var/postgresql/data/
LC_ALL is not supported yet, try LC_CTYPE.

$ sudo su - _postgresql
$ export LC_CTYPE=en_US.UTF-8
$ initdb -D /var/postgresql/data -U postgres -E UTF8 -A md5 -W
$ psql -U postgres -l
Password for user postgres:
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------------+-----------------------
postgres | postgres | UTF8 | C | en_US.UTF-8 |
template0 | postgres | UTF8 | C | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)

-f
--
if practice makes perfect, and nobody's perfect, why practice?
o***@hushmail.com
2015-01-21 20:41:53 UTC
Permalink
Hello,
Post by frantisek holop
LC_ALL is not supported yet, try LC_CTYPE.
$ sudo su - _postgresql
$ export LC_CTYPE=en_US.UTF-8
$ initdb -D /var/postgresql/data -U postgres -E UTF8 -A md5 -W
$ psql -U postgres -l
I couldn't get it to work with `LC_CTYPE`. It did, however, work with `initdb -D /var/postgresql/data/ --no-locale`.

O.D.
frantisek holop
2015-01-21 20:50:50 UTC
Permalink
Post by o***@hushmail.com
Hello,
Post by frantisek holop
LC_ALL is not supported yet, try LC_CTYPE.
$ sudo su - _postgresql
$ export LC_CTYPE=en_US.UTF-8
$ initdb -D /var/postgresql/data -U postgres -E UTF8 -A md5 -W
$ psql -U postgres -l
I couldn't get it to work with `LC_CTYPE`. It did, however, work with `initdb -D /var/postgresql/data/ --no-locale`.
you are not giving details, so i don't know.
but a non-utf8 database nowadays is very limiting.

-f
--
god? i'm no god. god has mercy.
o***@hushmail.com
2015-01-21 21:07:31 UTC
Permalink
Post by frantisek holop
you are not giving details, so i don't know.
but a non-utf8 database nowadays is very limiting.
Indeed, thanks for your example. I'm now rolling with `initdb -D /var/postgresql/data/ --no-locale -E UTF8`.

O.D.

Loading...