Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOOvz-0002c7-27 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Sep 2021 18:38:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mOOvx-0001c1-O6 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Sep 2021 18:38:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOOvx-0001bt-G6 for pgsql-hackers@lists.postgresql.org; Thu, 09 Sep 2021 18:38:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOOvu-0004jp-Or for pgsql-hackers@postgresql.org; Thu, 09 Sep 2021 18:38:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 189IbqFM3723478; Thu, 9 Sep 2021 14:37:53 -0400 From: Tom Lane To: Anton Voloshin cc: Pg Hackers , Peter Eisentraut Subject: Re: missing warning in pg_import_system_collations In-reply-to: <2fee0074-8ae8-20bd-ad94-0b22dcd7585e@postgrespro.ru> References: <429d64ee-188d-3ce1-106a-53a8b45c4fce@postgrespro.ru> <3607308.1631199070@sss.pgh.pa.us> <2fee0074-8ae8-20bd-ad94-0b22dcd7585e@postgrespro.ru> Comments: In-reply-to Anton Voloshin message dated "Thu, 09 Sep 2021 22:17:35 +0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3723476.1631212672.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 09 Sep 2021 14:37:52 -0400 Message-ID: <3723477.1631212672@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Anton Voloshin 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 encodin= gs */ 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