Re: missing warning in pg_import_system_collations - Mailing list pgsql-hackers

From Tom Lane
Subject Re: missing warning in pg_import_system_collations
Date
Msg-id 3723477.1631212672@sss.pgh.pa.us
Whole thread Raw
In response to Re: missing warning in pg_import_system_collations  (Anton Voloshin <a.voloshin@postgrespro.ru>)
Responses Re: missing warning in pg_import_system_collations  (Anton Voloshin <a.voloshin@postgrespro.ru>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Jaime Casanova
Date:
Subject: Re: Feedback on table expansion hook (including patch)
Next
From: Mark Dilger
Date:
Subject: Re: [Patch] ALTER SYSTEM READ ONLY