Anton Voloshin <a.voloshin@postgrespro.ru> writes:
> On 09/09/2021 21:51, Tom Lane wrote:
>> 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.
Another approach we could take is to deem the comment incorrect and
just remove it, codifying the current behavior of silently ignoring
unrecognized encodings. The reason that seems like it might be
appropriate is that the logic immediately below this bit silently
ignores encodings that are known but are frontend-only:
if (!PG_VALID_BE_ENCODING(enc))
continue; /* ignore locales for client-only encodings */
It's sure not very clear to me why one case deserves a message and the
other not. Perhaps they both do, which would lead to adding another
DEBUG1 message here.
regards, tom lane