pgsql: Remove ts_locale.c's lowerstr()

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove ts_locale.c's lowerstr()
Date: 2024-12-17 13:19:32
Message-ID: E1tNXU4-0002Ow-31@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove ts_locale.c's lowerstr()

lowerstr() and lowerstr_with_len() in ts_locale.c do the same thing as
str_tolower() that the rest of the system uses, except that the former
don't use the common locale provider framework but instead use the
global libc locale settings.

This patch replaces uses of lowerstr*() with str_tolower(...,
DEFAULT_COLLATION_OID). For instances that use a libc locale
globally, this will result in exactly the same behavior. For
instances that use other locale providers, you now get consistent
behavior and are no longer dependent on the libc locale settings (for
this case; there are others).

Most uses of these functions are for processing dictionary and
configuration files. In those cases, using the default collation
seems appropriate. At least we don't have a more specific collation
available. But the code in contrib/pg_trgm should really depend on
the collation of the columns being processed. This is not done here,
this can be done in a separate patch.

(You can probably construct some edge cases where this change would
create some locale-related upgrade incompatibility, for example if
before you used a combination of ICU and a differently-behaving libc
locale. We can document this in the release notes, but I don't think
there is anything more we can do about this.)

Reviewed-by: Jeff Davis <pgsql(at)j-davis(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/653f3b84-fc87-45a7-9a0c-bfb4fcab3e7d%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fb1a18810f07fc3b722392103d67ce8ed188b63d

Modified Files
--------------
contrib/dict_xsyn/dict_xsyn.c | 6 ++-
contrib/pg_trgm/trgm_op.c | 6 ++-
contrib/pg_trgm/trgm_regexp.c | 16 ++++---
src/backend/snowball/dict_snowball.c | 8 ++--
src/backend/tsearch/dict_ispell.c | 7 +--
src/backend/tsearch/dict_simple.c | 7 +--
src/backend/tsearch/dict_synonym.c | 8 ++--
src/backend/tsearch/spell.c | 7 +--
src/backend/tsearch/ts_locale.c | 89 ------------------------------------
src/backend/tsearch/ts_utils.c | 5 +-
src/include/tsearch/ts_locale.h | 3 --
src/include/tsearch/ts_public.h | 2 +-
12 files changed, 43 insertions(+), 121 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2024-12-17 14:49:08 pgsql: Update comments about index parallel builds
Previous Message Peter Eisentraut 2024-12-17 11:57:08 pgsql: Remove ts_locale.c's t_isdigit(), t_isspace(), t_isprint()