public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dominique Devienne <[email protected]>
To: Laurenz Albe <[email protected]>
Cc: [email protected]
Subject: Re: LOCALE C.UTF-8 on EDB Windows v17 server
Date: Thu, 5 Jun 2025 10:53:14 +0200
Message-ID: <CAFCRh--iJ4MT2exvXnvRPum+7su3Jn9qmnBQqxWsAtyEyEo83A@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAFCRh--rtqbOBpJYFDmPD9kYCYxsxKpLW7LHxYMYhHXa2XoStw@mail.gmail.com>
	<[email protected]>

On Thu, Jun 5, 2025 at 3:01 AM Laurenz Albe <[email protected]> wrote:
> On Wed, 2025-06-04 at 14:23 +0200, Dominique Devienne wrote:
> > The command I'm using (from a libpq trace) is:
> >
> > create database "dd_v168" encoding 'UTF8' locale 'C.UTF-8'
> > locale_provider 'builtin' template template0
> >
> > On Windows, I'm getting
> >
> > 2025-06-04 14:07:41.227419 B 155 ErrorResponse S "ERROR" V "ERROR" C
> > "42809" M "invalid LC_COLLATE locale name: "C.UTF-8"" H "If the locale
> > name is specific to ICU, use ICU_LOCALE." F "dbcommands.c" L "1057" R
> > "createdb" \x00
>
> Pilot error.  If you use "LOCALE_PROVIDER builtin", you have to specify
> BUILTIN LOCALE too:
>
> CREATE DATABASE b
>    TEMPLATE template0
>    LOCALE_PROVIDER builtin
>    BUILTIN_LOCALE 'C.UTF-8'
>    /* used for aspects other than collation and character type */
>    LOCALE 'C';

Thanks Laurenz. Indeed, Using LOCALE vs BUILTIN_LOCALE matters.

On Linux, no error unlike on Windows (still inconsistent there IMHO),
but the result is slightly different for datcollate and datctype (C vs en_US),
while the same for datlocprovider and datlocale, what I looked at.

Thus I kinda persist that there *is* a portability issue here.

Also, note what the doc says:

If locale_provider is builtin, then locale or builtin_locale must be
specified and set to either C or C.UTF-8.

It clearly says "locale or builtin_locale", emphasis on the OR.

So two issues here.
1) the doc is wrong or misleading on this.
2) the same command works on Linux, but not Windows.

FWIW. --DD

C:\Users\ddevienne>psql service=pau17
psql (17.4, server 17.5)
ddevienne=> select version();
                                                 version
---------------------------------------------------------------------------------------------------------
 PostgreSQL 17.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0
20210514 (Red Hat 8.5.0-26), 64-bit
(1 row)

ddevienne=> create database "dd_v168" encoding 'UTF8' locale 'C.UTF-8'
ddevienne-> locale_provider 'builtin' template template0;
CREATE DATABASE
ddevienne=> select datlocprovider, datlocale, datcollate, datctype
from pg_database where datname = 'dd_v168';
 datlocprovider | datlocale | datcollate | datctype
----------------+-----------+------------+----------
 b              | C.UTF-8   | C.UTF-8    | C.UTF-8
(1 row)

ddevienne=> create database "dd_v168b" encoding 'UTF8' builtin_locale 'C.UTF-8'
ddevienne-> locale_provider 'builtin' template template0;
CREATE DATABASE
ddevienne=> select datlocprovider, datlocale, datcollate, datctype
from pg_database where datname = 'dd_v168b';
 datlocprovider | datlocale | datcollate  |  datctype
----------------+-----------+-------------+-------------
 b              | C.UTF-8   | en_US.UTF-8 | en_US.UTF-8
(1 row)






view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: LOCALE C.UTF-8 on EDB Windows v17 server
  In-Reply-To: <CAFCRh--iJ4MT2exvXnvRPum+7su3Jn9qmnBQqxWsAtyEyEo83A@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox