Re: utf8 vs UTF-8

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Troels Arvin <troels(at)arvin(dot)dk>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: utf8 vs UTF-8
Date: 2024-05-18 15:23:04
Message-ID: 2763159.1716045784@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2024-05-18 15:27:19 Re: Left join syntax error
Previous Message Rich Shepard 2024-05-18 15:18:34 Re: Left join syntax error