Re: Remaining dependency on setlocale() - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Remaining dependency on setlocale()
Date
Msg-id a1396f17f462ee6561820f755caaf2d12eb9fd15.camel@j-davis.com
Whole thread Raw
In response to Re: Remaining dependency on setlocale()  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-hackers
On Thu, 2025-06-05 at 22:15 -0700, Jeff Davis wrote:
> To continue this thread, I did a symbol search in the meson build
> directory like (patterns.txt attached):

Attached a rough patch series which does what everyone seemed to agree
on:

  * Change some trivial ASCII cases to use pg_ascii_* variants
  * Set LC_COLLATE and LC_CTYPE to C with pg_perm_setlocale
  * Introduce a new global_lc_ctype for callers that still need to use
operations that depend on datctype

There should be no behavior changes in this series.

Benefits:

  * a tiny step toward multithreading, because connections to different
databases no longer require different setlocale() settings
  * easier to identify dependence on datctype, because callers will
need to refer to global_lc_ctype.
  * harder to accidentally depend on datctype or datcollate

Ideally, when the database locale provider is not libc, the user
shouldn't need to even think about a valid LC_CTYPE locale at all. But
that requires more work, and potentially risk of breakage.

Regards,
    Jeff Davis

`



Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: md5 password deprecation might cause problems with PgBouncer setups
Next
From: Noah Misch
Date:
Subject: Re: Issues with 2PC at recovery: CLOG lookups and GlobalTransactionData