Re: LOCALE C.UTF-8 on EDB Windows v17 server - Mailing list pgsql-general

From Dominique Devienne
Subject Re: LOCALE C.UTF-8 on EDB Windows v17 server
Date
Msg-id CAFCRh-8jd+VSPW5LXLYvmu8ByRhcqBB_dQoG1UsTHrcS8UJXFA@mail.gmail.com
Whole thread Raw
In response to Re: LOCALE C.UTF-8 on EDB Windows v17 server  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: LOCALE C.UTF-8 on EDB Windows v17 server
List pgsql-general
On Thu, Jun 5, 2025 at 4:52 AM Jeff Davis <pgsql@j-davis.com> wrote:
> > On Windows, I'm getting
> I tried on windows and linux and got the same result.

Thanks Jeff, for your informative email. The command work,
just like it does on Linux. YET... The results are NOT the same!

C:\Users\ddevienne>psql service=my17
psql (17.4, server 17.5)

ddevienne=> select version();
                                 version
-------------------------------------------------------------------------
 PostgreSQL 17.5 on x86_64-windows, compiled by msvc-19.43.34808, 64-bit
(1 row)

ddevienne=> create database "dd_v168" encoding 'UTF8' locale 'C.UTF-8'
ddevienne-> locale_provider 'builtin' template template0;
ERROR:  invalid LC_COLLATE locale name: "C.UTF-8"
HINT:  If the locale name is specific to ICU, use ICU_LOCALE.

ddevienne=> create database "dd_v168" 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_v168';
 datlocprovider | datlocale | datcollate | datctype
----------------+-----------+------------+----------
 b              | C.UTF-8   | C          | C
(1 row)

Contrast that with the results on Linux, I just sent in response to
Laurenz's message, and that I'll repeat below:

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_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)

Which means the same commands sometimes work, sometimes not, across platforms.
But when they work, they don't even yield the SAME results. Which
means it's not portable IMHO...

So... It is possible to have the SAME command on Windows and Linux,
which yields the SAME datcollate and datctype values???
So far, such a command eludes me, I'm afraid. --DD



pgsql-general by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: Feature request: Settings to disable comments and multiple statements in a connection
Next
From: Dominique Devienne
Date:
Subject: Re: LOCALE C.UTF-8 on EDB Windows v17 server