From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | initdb --no-locale=C doesn't work as specified when the environment is not C |
Date: | 2023-11-22 07:27:00 |
Message-ID: | 20231122.162700.1995154567625541112.horikyota.ntt@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Commit 3e51b278db leaves lc_* conf lines as commented-out when
their value is "C". This leads to the following behavior.
$ echo LANG
ja_JP.UTF8
$ initdb --no-locale hoge
$ grep lc_ hoge/postgresql.conf
#lc_messages = 'C' # locale for system error message
#lc_monetary = 'C' # locale for monetary formatting
#lc_numeric = 'C' # locale for number formatting
#lc_time = 'C' # locale for time formatting
In this scenario, the postmaster ends up emitting log massages in
Japanese, which contradicts the documentation.
https://www.postgresql.org/docs/devel/app-initdb.html
> --locale=locale
> Sets the default locale for the database cluster. If this option is
> not specified, the locale is inherited from the environment that
> initdb runs in. Locale support is described in Section 24.1.
>
..
> --lc-messages=locale
> Like --locale, but only sets the locale in the specified category.
Here's a somewhat amusing case:
$ echo LANG
ja_JP.UTF8
$ initdb --lc_messages=C
$ grep lc_ hoge/postgresql.conf
#lc_messages = 'C' # locale for system error message
lc_monetary = 'ja_JP.UTF8' # locale for monetary formatting
lc_numeric = 'ja_JP.UTF8' # locale for number formatting
lc_time = 'ja_JP.UTF8' # locale for time formatting
Hmm. it seems that initdb replaces the values of all categories
*except the specified one*. This behavior seems incorrect to
me. initdb should replace the value when explicitly specified in the
command line. If you use -c lc_messages=C, it does perform the
expected behavior to some extent, but I believe this is a separate
matter.
I have doubts about not replacing these lines for purely cosmetic
reasons. In this mail, I've attached three possible solutions for the
original issue: the first one enforces replacement only when specified
on the command line, the second one simply always performs
replacement, and the last one addresses the concern about the absence
of quotes around "C" by allowing explicit specification. (FWIW, I
prefer the last one.)
What do you think about these?
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
1_initdb_set_conf_when_specified.txt | text/plain | 2.0 KB |
2_initdb_set_all_categories.txt | text/plain | 1.3 KB |
3_initdb_force_quote_lc_values.txt | text/plain | 7.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2023-11-22 07:31:10 | Re: Make mesage at end-of-recovery less scary. |
Previous Message | John Naylor | 2023-11-22 07:09:12 | Re: Change GUC hashtable to use simplehash? |