On 09/09/2021 21:51, Tom Lane wrote:
> What you propose to do here would promote this case from
> ought-to-be-DEBUG1 to WARNING, which seems to me to be way too much in the
> user's face. Or, if there actually is a case for complaining, then all
> those messages ought to be WARNING not DEBUG1. ...
>
> Assuming we don't want to change pg_get_encoding_from_locale()'s API,
> the simplest fix is to duplicate its error message, so more or less
>
> if (enc < 0)
> {
> - /* error message printed by pg_get_encoding_from_locale() */
> + elog(DEBUG1, "could not determine encoding for locale \"%s\"",
> + localebuf)));
> continue;
> }
Upon thinking a little more, I agree.
The warnings I happen to get from initdb on my current machine (with
many various locales installed, more than on a typical box) are:
performing post-bootstrap initialization ... 2021-09-09 22:04:01.678 +07
[482312] WARNING: could not determine encoding for locale
"hy_AM.armscii8": codeset is "ARMSCII-8"
2021-09-09 22:04:01.679 +07 [482312] WARNING: could not determine
encoding for locale "ka_GE": codeset is "GEORGIAN-PS"
2021-09-09 22:04:01.679 +07 [482312] WARNING: could not determine
encoding for locale "kk_KZ": codeset is "PT154"
2021-09-09 22:04:01.679 +07 [482312] WARNING: could not determine
encoding for locale "kk_KZ.rk1048": codeset is "RK1048"
2021-09-09 22:04:01.686 +07 [482312] WARNING: could not determine
encoding for locale "tg_TJ": codeset is "KOI8-T"
2021-09-09 22:04:01.686 +07 [482312] WARNING: could not determine
encoding for locale "th_TH": codeset is "TIS-620"
ok
While they are definitely interesting as DEBUG1, not so as a WARNING.
So, +1 from me for your proposed elog(DEBUG1, ...); patch. Thank you.
--
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ru