Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8Ltx-00BzIB-ID for pgsql-general@arkaria.postgresql.org; Sat, 18 May 2024 15:23:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s8Ltx-007oI0-KS for pgsql-general@arkaria.postgresql.org; Sat, 18 May 2024 15:23:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8Ltx-007oHr-9R for pgsql-general@lists.postgresql.org; Sat, 18 May 2024 15:23:13 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8Ltu-000pqT-Vm for pgsql-general@lists.postgresql.org; Sat, 18 May 2024 15:23:12 +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 44IFN4572763160; Sat, 18 May 2024 11:23:04 -0400 From: Tom Lane To: Adrian Klaver cc: Troels Arvin , pgsql-general@lists.postgresql.org Subject: Re: utf8 vs UTF-8 In-reply-to: References: <2388205.1715953909@sss.pgh.pa.us> <89165125-54b6-46a2-9b2c-0a7e275596bf@arvin.dk> Comments: In-reply-to Adrian Klaver message dated "Sat, 18 May 2024 08:01:17 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2763158.1716045784.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sat, 18 May 2024 11:23:04 -0400 Message-ID: <2763159.1716045784@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Adrian Klaver writes: > On 5/18/24 07:48, Troels Arvin wrote: >> Also, when I try to create a database with "en_US.utf8" as locale >> without specifying a template: >> >> troels=# create database test4 locale 'en_US.utf8'; >> ERROR:  new collation (en_US.utf8) is incompatible with the collation of >> the template database (en_US.UTF-8) >> HINT:  Use the same collation as in the template database, or use >> template0 as template. > I'm going to say that is Postgres being exact to a fault. Yeah. glibc will treat those two locale names as equivalent, and I think most if not all other libc implementations do too. But Postgres doesn't know that so it demands exact textual equality before assuming two locale names are equivalent. If this is getting in your way you could probably get away with just UPDATE-ing pg_database to use whichever spelling you think is preferable; the strings appearing in datcollate and datctype aren't stored anywhere else. (But experiment in a scratch installation to verify that ... and don't try changing them to something that you don't know to be semantically equivalent.) regards, tom lane