Re: LOCALE C.UTF-8 on EDB Windows v17 server

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Dominique Devienne" <ddevienne(at)gmail(dot)com>
Cc: "Laurenz Albe" <laurenz(dot)albe(at)cybertec(dot)at>,pgsql-general(at)postgresql(dot)org
Subject: Re: LOCALE C.UTF-8 on EDB Windows v17 server
Date: 2025-06-05 15:01:52
Message-ID: 5da10da1-c842-43fa-acf8-98a1fe8ddcfd@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dominique Devienne wrote:

> > locale 'C.UTF-8' or lc_collate 'C.UTF-8' lc_ctype 'C.UTF-8'
> > cannot work on Windows because Windows does not have a locale
> > named C.UTF-8, whereas a Linux system does (well at least recent
> > Linuxes. Some old Linuxes don't).
>
> But isn't the point of the new-in-v17 builtin provider is to be system
> independent???

Yes, definitely.

But suppose your database has an extension that calls local-dependent
code, such as strxfrm() [1] for instance.

The linked MSVC doc says:

"The transformation is made using the locale's LC_COLLATE category
setting. For more information on LC_COLLATE, see setlocale. strxfrm
uses the current locale for its locale-dependent behavior"

But what will be the value in LC_COLLATE when this extension code
is running in a database using the builtin provider?
It's the value found in pg_database.datcollate that was specified
when creating the database with the lc_collate or locale option.

The builtin provider routines are used for code inside Postgres
core, but code outside its perimeter can still call libc functions
that depend on lc_collate and lc_ctype.

[1]
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strxfrm-wcsxfrm-strxfrm-l-wcsxfrm-l?view=msvc-170

Best regards,
--
Daniel Vérité
https://postgresql.verite.pro/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2025-06-05 15:40:04 Re: LOCALE C.UTF-8 on EDB Windows v17 server
Previous Message Dominique Devienne 2025-06-05 13:07:49 Re: LOCALE C.UTF-8 on EDB Windows v17 server