tiny step toward threading: reduce dependence on setlocale()

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: tiny step toward threading: reduce dependence on setlocale()
Date: 2024-06-06 00:23:25
Message-ID: 2228884bb1f1a02614b39f71a90c94d2cc8a3a2f.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


There was an unconference session at pgconf.dev related to threading
support. One of the problems identified was setlocale().

The attached series of patches make collation not depend on
setlocale(), even if the database collation uses the libc provider.

Since commit 8d9a9f034e, all supported platforms have locale_t, so we
can use strcoll_l(), etc., or uselocale() when no "_l" variant is
available.

A brief test shows that there may be a performance regression for libc
default collations. But if so, I'm not sure that's avoidable if the
goal is to take away setlocale. I'll see if removing the extra branches
mitigates it.

--
Jeff Davis
PostgreSQL Contributor Team - AWS

Attachment Content-Type Size
v1-0001-Make-database-default-collation-internal-to-pg_lo.patch text/x-patch 5.7 KB
v1-0002-Make-database-collation-pg_locale_t-always-non-NU.patch text/x-patch 2.6 KB
v1-0003-ts_locale.c-do-not-use-NULL-to-mean-the-database-.patch text/x-patch 3.2 KB
v1-0004-Remove-support-for-null-pg_locale_t.patch text/x-patch 10.3 KB
v1-0005-Avoid-setlocale-in-lc_collate_is_c-and-lc_ctype_i.patch text/x-patch 14.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-06-06 00:43:31 Re: ALTER TABLE SET ACCESS METHOD on partitioned tables
Previous Message Heikki Linnakangas 2024-06-06 00:01:12 Re: [multithreading] extension compatibility