From: Tom Lane <tgl@sss.pgh.pa.us>
To: Anton Voloshin <a.voloshin@postgrespro.ru>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Subject: Re: missing warning in pg_import_system_collations
Date: Sat, 11 Sep 2021 12:19:49 -0400
Message-ID: <63920.1631377189@sss.pgh.pa.us> (raw)
In-Reply-To: <0ad8d349-8857-bcb1-8dea-64a393017713@postgrespro.ru>
References: <429d64ee-188d-3ce1-106a-53a8b45c4fce@postgrespro.ru>
<3607308.1631199070@sss.pgh.pa.us>
<2fee0074-8ae8-20bd-ad94-0b22dcd7585e@postgrespro.ru>
<3723477.1631212672@sss.pgh.pa.us>
<0ad8d349-8857-bcb1-8dea-64a393017713@postgrespro.ru>
Anton Voloshin <a.voloshin@postgrespro.ru> writes:
> On 10/09/2021 01:37, Tom Lane wrote:
>> 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.
> I'm not an expert in locales, but I think it makes some sense to be
> silent about encodings we have consciously decided to ignore as we have
> them in our tables, but marked them as frontend-only
> (!PG_VALID_BE_ENCODING(enc)).
I'm not really buying that. It seems to me that the only reason anyone
would examine this debug output at all is that they want to know "why
didn't this locale (which I can see in 'locale -a' output) get imported?".
So the only cases I'm inclined to not log about are when we skip a locale
because there's already a matching pg_collation entry.
I experimented with the attached draft patch. The debug output on my
RHEL8 box (with a more-or-less-default set of locales) looks like
2021-09-11 12:13:09.908 EDT [41731] DEBUG: could not identify encoding for locale "hy_AM.armscii8"
2021-09-11 12:13:09.909 EDT [41731] DEBUG: could not identify encoding for locale "ka_GE"
2021-09-11 12:13:09.909 EDT [41731] DEBUG: could not identify encoding for locale "ka_GE.georgianps"
2021-09-11 12:13:09.909 EDT [41731] DEBUG: could not identify encoding for locale "kk_KZ"
2021-09-11 12:13:09.909 EDT [41731] DEBUG: could not identify encoding for locale "kk_KZ.pt154"
2021-09-11 12:13:09.926 EDT [41731] DEBUG: could not identify encoding for locale "tg_TJ"
2021-09-11 12:13:09.926 EDT [41731] DEBUG: could not identify encoding for locale "tg_TJ.koi8t"
2021-09-11 12:13:09.926 EDT [41731] DEBUG: could not identify encoding for locale "th_TH"
2021-09-11 12:13:09.926 EDT [41731] DEBUG: could not identify encoding for locale "th_TH.tis620"
2021-09-11 12:13:09.926 EDT [41731] DEBUG: could not identify encoding for locale "thai"
2021-09-11 12:13:09.929 EDT [41731] DEBUG: skipping client-only locale "zh_CN.gb18030"
2021-09-11 12:13:09.929 EDT [41731] DEBUG: skipping client-only locale "zh_CN.gbk"
2021-09-11 12:13:09.930 EDT [41731] DEBUG: skipping client-only locale "zh_HK"
2021-09-11 12:13:09.930 EDT [41731] DEBUG: skipping client-only locale "zh_HK.big5hkscs"
2021-09-11 12:13:09.930 EDT [41731] DEBUG: skipping client-only locale "zh_SG.gbk"
2021-09-11 12:13:09.930 EDT [41731] DEBUG: skipping client-only locale "zh_TW"
2021-09-11 12:13:09.930 EDT [41731] DEBUG: skipping client-only locale "zh_TW.big5"
I don't see a good reason to think that someone would be less confused
about why we reject zh_HK than why we reject th_TH. So I think if we're
going to worry about this then we should add both messages.
regards, tom lane
Attachments:log-debug-messages-for-rejected-locales.patch (text/x-diff, 814B) downloaddiff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.cindex 4075f991a0..8fe8227751 100644--- a/src/backend/commands/collationcmds.c+++ b/src/backend/commands/collationcmds.c@@ -597,11 +597,15 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
enc = pg_get_encoding_from_locale(localebuf, false);
if (enc < 0)
{
- /* error message printed by pg_get_encoding_from_locale() */+ elog(DEBUG1, "could not identify encoding for locale \"%s\"",+ localebuf);
continue;
}
if (!PG_VALID_BE_ENCODING(enc))
- continue; /* ignore locales for client-only encodings */+ {+ elog(DEBUG1, "skipping client-only locale \"%s\"", localebuf);+ continue;+ }
if (enc == PG_SQL_ASCII)
continue; /* C/POSIX are already in the catalog */
=
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, a.voloshin@postgrespro.ru, peter.eisentraut@enterprisedb.com
Subject: Re: missing warning in pg_import_system_collations
In-Reply-To: <63920.1631377189@sss.pgh.pa.us>
References: <429d64ee-188d-3ce1-106a-53a8b45c4fce@postgrespro.ru> <3607308.1631199070@sss.pgh.pa.us> <2fee0074-8ae8-20bd-ad94-0b22dcd7585e@postgrespro.ru> <3723477.1631212672@sss.pgh.pa.us> <0ad8d349-8857-bcb1-8dea-64a393017713@postgrespro.ru> <63920.1631377189@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox