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 1mOaKH-00056c-Uv for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Sep 2021 06:47:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mOaKG-0004CK-Th for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Sep 2021 06:47:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOaKG-0004CC-Gk for pgsql-hackers@lists.postgresql.org; Fri, 10 Sep 2021 06:47:52 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mOaKE-0003Er-Tx for pgsql-hackers@postgresql.org; Fri, 10 Sep 2021 06:47:52 +0000 Received: from [192.168.28.142] (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 2F37821CB064; Fri, 10 Sep 2021 09:47:49 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1631256469; bh=kOH3qYTkxkohD+JfsFCXjmiSzdwnBpyTIp7euXxDeF8=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=XDPrC6ASypLjTm1smr8SYywyzbCgFfoGqp2+FtXSfqCCfAWI/B+ytCbgoZY4r3K85 3oIfen5ygtqRmW6R5KneXKRSx7oEiCy73pvr01ydSWv242270O08uq28RvpbFHDj8s 9c3sIIzcMnqZ77FBa93/UwcShMQKmw3eysERKMo0= Subject: Re: missing warning in pg_import_system_collations To: Tom Lane Cc: Pg Hackers , Peter Eisentraut 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> From: Anton Voloshin Message-ID: <0ad8d349-8857-bcb1-8dea-64a393017713@postgrespro.ru> Date: Fri, 10 Sep 2021 13:47:48 +0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <3723477.1631212672@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/09/2021 01:37, Tom Lane wrote: > 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. 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)). Just like it makes sense to do give a debug-level warning about encodings seen in locale -a output but not recognized by us at all (pg_get_encoding_from_locale(localebuf, false) < 0). Therefore I think your patch with duplicated error message is better than what we have currently. I don't see how adding debug-level messages about skipping frontend-only encodings would be of any significant use here. Unless someone more experienced in locales' subtleties would like to chime in. -- Anton Voloshin Postgres Professional, The Russian Postgres Company https://postgrespro.ru