Hi Jonathan, and thanks for your answer !
I went with your suggestion and had a closer look at the Synapse code
and documentation.
When connecting to an existing database, Synapse expects following
values to be set:
ENCONDNG='UTF8'
LC_COLLATE='C'
LC_CTYPE='C'
See:
https://github.com/matrix-org/synapse/blob/master/synapse/storage/engines/postgres.py#L41
They also state that "Synapse will refuse to set up a new database if
it has the wrong values of COLLATE and CTYPE set, and will log
warnings on existing databases."
(
https://github.com/matrix-org/synapse/blob/master/docs/postgres.md#fixing-incorrect-collate-or-ctype)
And provide an example how to create a DB for Synapse:
createdb --encoding=UTF8 --locale=C --template=template0
--owner=synapse_user synapse
See:
https://github.com/matrix-org/synapse/blob/master/docs/postgres.md#set-up-database
It looks to me as I can't customize the expected locate (collate /
ctype) value in Synapse. It won't start if the provided DB isn't
configured with locale = C.
Therefore I'm back at trying to set a custom LC_COLLATE and LC_CTYPE
value in the postgres Operator. In my previous email, I described the
procedure I followed in order to create a "matrix" database with
locale = C and encoding = C using a custom configuration. I adapted it
to set only locale = C and leave encoding to its default value (UTF8)
as follows:
[mgoerens@mgoerens test-pgsql-k8s-op]$ cat set-encoding-c.yaml
---
bootstrap:
initdb:
- locale: 'C'
[mgoerens@mgoerens test-pgsql-k8s-op]$ kubectl create configmap
matrix-custom-config --from-file=set-encoding-c.yaml
The rest of the procedure is untouched.
However the matrix database is created with following values:
matrix=> SHOW SERVER_ENCODING;
server_encoding
-----------------
UTF8
(1 row)
matrix=> SELECT datcollate, datctype FROM pg_database WHERE datname =
current_database();
datcollate | datctype
-------------+-------------
en_US.utf-8 | en_US.utf-8
(1 row)
I'm still not sure if my procedure is incorrect or if there is a
limitation with setting a custom locale value.
Thanks,
Matthias