pgsql: Make collation not depend on setlocale().

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make collation not depend on setlocale().
Date: 2024-07-30 08:13:19
Message-ID: E1sYhyx-001rY1-9v@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make collation not depend on setlocale().

Now that the result of pg_newlocale_from_collation() is always
non-NULL, then we can move the collate_is_c and ctype_is_c flags into
pg_locale_t. That simplifies the logic in lc_collate_is_c() and
lc_ctype_is_c(), removing the dependence on setlocale().

This commit also eliminates the multi-stage initialization of the
collation cache.

As long as we have catalog access, then it's now safe to call
pg_newlocale_from_collation() without checking lc_collate_is_c()
first.

Discussion: https://postgr.es/m/cfd9eb85-c52a-4ec9-a90e-a5e4de56e57d@eisentraut.org
Reviewed-by: Peter Eisentraut, Andreas Karlsson

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/72fe6d24a38c88e112d5e63a8e907c3e96ae46ad

Modified Files
--------------
src/backend/utils/adt/pg_locale.c | 180 +++++------------------------
src/include/utils/pg_locale.h | 14 +++
src/test/regress/expected/collate.utf8.out | 26 +++++
src/test/regress/sql/collate.utf8.sql | 15 +++
4 files changed, 81 insertions(+), 154 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2024-07-30 08:20:15 pgsql: Disallow setting MAX_PARTITION_BUFFERS to less than 2
Previous Message Richard Guo 2024-07-30 06:53:53 pgsql: Refactor the checks for parameterized partial paths