Re: CREATE DATABASE command for non-libc providers

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Jeff Davis" <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CREATE DATABASE command for non-libc providers
Date: 2025-06-06 20:03:07
Message-ID: 73959a14-267b-49c1-8293-291b175682cb@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Davis wrote:

> I have attached a patch 0001 that
> fixes a misleading hint, but it's still not great.

+1 for the patch

> When using ICU or the builtin provider, it still requires coming up
> with some valid locale name for LC_COLLATE and LC_CTYPE

No, since the following invocation does work:

CREATE DATABASE test
template='template0'
locale_provider='builtin'
builtin_locale='C.UTF-8';

Here we let 'locale' or 'lc_collate/lc_ctype' which is the same thing,
defaulting from the template database.

In the discussion you mentioned, the error comes from the OP using
'locale' instead of 'builtin_locale'. At least that's my understanding.
This mistake is not surprising, because when you specify a locale
provider followed by a locale, intuitively you'd expect this locale
to refer to that locale provider. Yet that's not case, mostly for backward
compatibility reasons.

> * Force the environment variables LC_COLLATE=C and LC_CTYPE=C
> unconditionally, and pg_perm_setlocale() them

Currently that would be a regression for some people, because
when LC_CTYPE=C, the FTS parser produces substandard results with
characters beyond ASCII.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nico Williams 2025-06-06 20:18:50 Re: Unnecessary connection overhead due copy-on-write (mainly openssl)
Previous Message Andres Freund 2025-06-06 19:37:45 Re: Non-reproducible AIO failure