Re: utf8 vs UTF-8 - Mailing list pgsql-general

From Tom Lane
Subject Re: utf8 vs UTF-8
Date
Msg-id 2763159.1716045784@sss.pgh.pa.us
Whole thread Raw
In response to Re: utf8 vs UTF-8  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
Adrian Klaver <adrian.klaver@aklaver.com> 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



pgsql-general by date:

Previous
From: Rich Shepard
Date:
Subject: Re: Left join syntax error
Next
From: "David G. Johnston"
Date:
Subject: Re: Left join syntax error