reactive-tech / kubegres

Kubegres is a Kubernetes operator allowing to deploy one or many clusters of PostgreSql instances and manage databases replication, failover and backup.
https://www.kubegres.io
Apache License 2.0
1.31k stars 74 forks source link

Locale(s) can not be set / won't be generated @setup #161

Open clauspruefer opened 1 year ago

clauspruefer commented 1 year ago

It should be possible to provide a "unix"-locale (or multiple locales) at setup time to specify result-ordering, monetary, number and time formating in different languages.

The default locale is not suitable for e.g. german language where characters ä,ö,ü,ß are essential. Also US date format is not readable by the most german citizens.

The following process describes how to generate locale(s) and to configure it. It should of course be possible to define all the locale settings (parameters) in the kubegres .yaml config-files.

1. Choose correct locale(s) / generate

Of course put the locale(s) specified in the kubegres config inside /etc/locale.gen and locale-gen inside docker container!

2. Set for initb cluster-creation (or in postgresql.conf)

It is possible to set the locales in postgresql.conf file or as initdb parameter.

Example (Canadian French global, Monetary US style): initdb --locale=fr_CA --lc-monetary=en_US

The following locales can be set (according to postgresq-15 documentation):

Constant | Description -- | -- LC_COLLATE | String sort order LC_CTYPE | Character classification (What is a letter? Its upper-case equivalent?) LC_MESSAGES | Language of messages LC_MONETARY | Formatting of currency amounts LC_NUMERIC | Formatting of numbers LC_TIME | Formatting of dates and times

Also i think they forgot "LC_ALL"

Implementors should consider: locale settings can be set in 3 different ways

  1. postresql.conf
  2. initdb (parameters)
  3. Shell environment

Also parameter naming could be slightly different for the given ways!