pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
postgresql encoding/locale issues
I've been using postgresql for Home Assistant and Synapse for quite a
while with no issues, all on NetBSD 9 amd64. Recently I set up a test
environment for Home Assistant and have run into locale/encoding issues.
On both of my production/ok machines, 'pg_dump hass' shows
SET client_encoding = 'UTF8';
which seems expected/normal these days. Both have postgresql12.
My own shell environment has
LANG=en_US.UTF-8
which as I understand should mean LC_* are all that value, which also
seems normal (to be using UTF-8, and one's own language). I have added
LC_CTYPE and LC_ALL after searching about this.
On the test box, I have installed postgresql12 from 2023Q1. Trying to
start the server -- with no datbase yet -- gets me:
/usr/pkg/pgsql #> /etc/rc.d/pgsql start
Initializing PostgreSQL databases.
initdb: error: invalid locale settings; check LANG and LC_* environment variables
pg_ctl: database system initialization failed
/usr/pkg/pgsql #> env|egrep LANG\|LC
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
With all three removed, a database is created but the client_encoding
is ASCII. This breaks Home Assistant.
If I remove LANG and LC_ALL, but leave LC_CTYPE, postgresql starts and
creates a database.
So:
Obviously (these days) one should be creating databases with UTF-8,
absent some special reason. Correct?
If postgresql cares about LC_CTYPE for encoding, why is it objecting
to other locale variables being set?
What do we think will happen when the machine boots with no database
and creates it? Why do we think that's ok, or is it a bug?
Home |
Main Index |
Thread Index |
Old Index