On Tue, Dec 23, 2025 at 08:42:56PM +0100, Nicolas George wrote:
> [email protected] (HE12025-12-23):
> > Hm. In the general or in the specific?
> 
> I do not understand the question.
> 
> > I don't know how a database could build a text index without taking into
> > account locales (especially, but not only collation).
> > 
> > At index creation you may, of course, state which, but it will inherit
> > its default from template1, and this one is set at cluster creation
> > (which, for Debian, happens at package -- first -- install).
> > 
> > What would be your aprproach to do it better?
> 
> (1) Sanitize the environment when starting the cluster so as not to let
> the weird settings from the system or, even worse, the user who started
> the init script, affect its workings.

The problem is -- what does "weird" mean? If you don't override things,
cluster creation falls back to the environment. To me, that makes sense.

Perhaps it would be the distro's job to be more explicit at cluster
creation time (and remember, template0's setting is "just" a default
for createdb/CREATE DATABASE.

> (2) Use explicit settings with each a specific meaning? One setting for
> the collation rules, etc.

IMO, PostgreSQL already caters for that [1]

> (3) To implement it, use a library with a dedicated interface, not hack
> that changes the behaviour of standard library functions in a
> system-dependant way.

PostgreSQL already gives you the choice between two libraries (ICU support
has to be compiled in, of course), See also [1].

Yes, in general it makes sense to have the "system locale" (I also agree
that this is a problematic concept) at least have LANG=C.utf-8. But there
might be reasons to do otherwise.

Cheers
-- 
tomás

Attachment: signature.asc
Description: PGP signature

Reply via email to