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 1nUUaY-0001px-Vr for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Mar 2022 14:25:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nUUaW-00069U-Sd for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Mar 2022 14:25:20 +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 1nUUaV-00069L-PN for pgsql-hackers@lists.postgresql.org; Wed, 16 Mar 2022 14:25:20 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nUUaQ-0001pp-FY for pgsql-hackers@postgresql.org; Wed, 16 Mar 2022 14:25:19 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 990455C01E1; Wed, 16 Mar 2022 10:25:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 16 Mar 2022 10:25:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=nRz2Y/GEponiCm7r/U/dmFeAVLRfQEZZMpYdGJpY+ S8=; b=WfDYvyciYk35Thytarn84fofW2FsQ5UfkCvEYQ4DAN6dd1C+edLtFVDow LFQjpnM7wK1CqAxCROJJLACL5qJVDSIhOldRnBAT5C6LnoIvlmAjALJsuY7CEB1Y O7izAvxnm5qWK34tneRg+Oc0nEaZrLdeGMD1FrSGoHrMalPHGqM1AwGPXGmg+sfa aLnAG+Lzs9EXJFo4Fkn9vn1CbbctDQTBUgaIzFgSvhbXCx/jcGp9l7Ft5k4Nbcgj rl4QLxl6l2ImpDnulvmWfVV6AjCFseZB7bFM7+QEKc7lixE7shs+Hq/IzxA4K3Us 5nDKDyysTTfiIiVeCj2jO0OZ9a7dA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudefvddgieduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepfeejgeehteeuhfevvedu leeufedtjeetiefftedvudfhtdeifefgueettdevgefgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 16 Mar 2022 10:25:11 -0400 (EDT) Message-ID: <07878ad1-d94d-5a92-565f-c0dfdea8b61b@enterprisedb.com> Date: Wed, 16 Mar 2022 15:25:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: ICU for global collation Content-Language: en-US To: Robert Haas Cc: Julien Rouhaud , pgsql-hackers , Daniel Verite References: <20220118040246.dewl5pain2gkv2iv@jrouhaud> <171c5f7c-43ee-dbe9-31f9-5e3eb06a54cf@enterprisedb.com> <20220121135119.ywszwl4353v5dzh5@jrouhaud> <20220121161331.xn7fhtfg5j2ucilb@jrouhaud> <87e93704-b7f7-71f6-161d-8713e6334ed3@enterprisedb.com> <704405ed-f1fa-d2a7-b9f9-48a07fb45648@enterprisedb.com> <96a50803-72ba-8eec-948a-d87608ac15a0@enterprisedb.com> <20220305083830.lpz3k3yku5lmm5xs@jrouhaud> <42ce518d-1426-fa9e-1fcc-de090cd55331@enterprisedb.com> From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 15.03.22 18:28, Robert Haas wrote: > On Tue, Mar 15, 2022 at 12:58 PM Peter Eisentraut > wrote: >> On 14.03.22 19:57, Robert Haas wrote: >>> 1. What will happen if I set the ICU collation to something that >>> doesn't match the libc collation? How bad are the consequences? >> >> These are unrelated, so there are no consequences. > > Can you please elaborate on this? The code that is aware of ICU generally works like this: if (locale_provider == ICU) result = call ICU code else result = call libc code return result However, there is code out there, both within PostgreSQL itself and in extensions, that does not do that yet. Ideally, we would eventually change all that over, but it's not happening now. So we ought to preserve the ability to set the libc to keep that legacy code working for now. This legacy code by definition doesn't know about ICU, so it doesn't care whether the ICU setting "matches" the libc setting or anything like that. It will just do its thing depending on its own setting. The only consequence of settings that don't match is that the different pieces of code behave semantically inconsistently (e.g., some routine thinks the data is Greek and other code thinks the data is French). But that's up to the user to set correctly. And the actual scenarios where you can actually do anything semantically relevant this way are very limited. A second point is that the LC_CTYPE setting tells other parts of libc what the current encoding is. This affects gettext for example. So you need to set this to something sensible even if you don't use libc locale routines otherwise. >>> 2. If I want to avoid a mismatch between the two, then I will need a >>> way to figure out which libc collation corresponds to a given ICU >>> collation. How do I do that? >> >> You can specify the same name for both. > > Hmm. If every name were valid in both systems, I don't think you'd be > proposing two fields. Earlier versions of this patch and predecessor patches indeed had common fields. But in fact the two systems accept different values if you want to delve into the advanced features. But for basic usage something like "en_US" will work for both.