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 1ppwGF-0008W0-72 for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Apr 2023 19:17:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ppwGE-0004XR-3O for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Apr 2023 19:17:34 +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 1ppwDI-0008S4-KF for pgsql-hackers@lists.postgresql.org; Fri, 21 Apr 2023 19:14:32 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ppwDB-0018AO-HE for pgsql-hackers@lists.postgresql.org; Fri, 21 Apr 2023 19:14:31 +0000 Received: from [192.168.127.4] (port=57148 helo=erlenstar.riddles.org.uk) by lungold.riddles.org.uk with esmtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1ppwD7-000Czw-47; Fri, 21 Apr 2023 19:14:21 +0000 Received: from localhost ([127.0.0.1]:50525 helo=erlenstar.riddles.org.uk) by erlenstar.riddles.org.uk with esmtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1ppwD6-000899-IZ; Fri, 21 Apr 2023 19:14:20 +0000 From: Andrew Gierth To: Tom Lane Cc: Peter Eisentraut , Sandro Santilli , Regina Obe , pgsql-hackers@lists.postgresql.org, Jeff Davis Subject: Re: Order changes in PG16 since ICU introduction In-Reply-To: <3369718.1682100417@sss.pgh.pa.us> (Tom Lane's message of "Fri, 21 Apr 2023 14:06:57 -0400") Message-ID: <874jp9f5jo.fsf@news-spur.riddles.org.uk> References: <000b01d97465$c34bbd60$49e33820$@pcorp.us> <3353947.1682092131@sss.pgh.pa.us> <533d93c5-f604-8e5f-4a48-975c08c53d59@enterprisedb.com> <878relf7cb.fsf@news-spur.riddles.org.uk> <3369718.1682100417@sss.pgh.pa.us> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (berkeley-unix) Date: Fri, 21 Apr 2023 20:14:20 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk >>>>> "Tom" == Tom Lane writes: >> Also, somewhere along the line someone broke initdb --no-locale, >> which should result in C locale being the default everywhere, but >> when I just tested it it picked 'en' for an ICU locale, which is not >> the right thing. Tom> Confirmed: Tom> $ LANG=en_US.utf8 initdb --no-locale Tom> The files belonging to this database system will be owned by user "postgres". Tom> This user must also own the server process. Tom> Using default ICU locale "en_US". Tom> Using language tag "en-US" for ICU locale "en_US". Tom> The database cluster will be initialized with this locale configuration: Tom> provider: icu Tom> ICU locale: en-US Tom> LC_COLLATE: C Tom> LC_CTYPE: C Tom> ... Tom> That needs to be fixed: --no-locale should prevent any Tom> consideration of initdb's LANG/LC_foo environment. Would it also not make sense to also take into account any --locale and --lc-* options before choosing an ICU default locale? Right now if you do, say, initdb --locale=fr_FR you get an ICU locale based on the environment but lc_* settings based on the option, which seems maximally confusing. Also, what happens now to lc_collate_is_c() when the provider is ICU? Am I missing something, or is it never true now, even if you specified C / POSIX / en-US-u-va-posix as the ICU locale? This seems like it could be an important pessimization. Also also, we now have the problem that it is much harder to create a 'C' collation database within an existing cluster (e.g. for testing) without knowing whether the default provider is ICU. In the past one would have done: CREATE DATABASE test TEMPLATE=template0 ENCODING = 'UTF8' LOCALE = 'C'; but now that creates a database that uses the same ICU locale as template0 by default. If instead one tries: CREATE DATABASE test TEMPLATE=template0 ENCODING = 'UTF8' LOCALE = 'C' ICU_LOCALE='C'; then one gets an error if the default locale provider is _not_ ICU. The only option now seems to be: CREATE DATABASE test TEMPLATE=template0 ENCODING = 'UTF8' LOCALE = 'C' LOCALE_PROVIDER = 'libc'; which of course doesn't work in older pg versions. -- Andrew.