pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove ts_locale.c's lowerstr()
Date: Tue, 17 Dec 2024 13:19:32 +0000
Message-ID: <E1tNXU4-0002Ow-31@gemulon.postgresql.org> (raw)

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@j-davis.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(-)



Message-ID: <E1tNXU4-0002Ow-31@gemulon.postgresql.org>
Permalink:  ../E1tNXU4-0002Ow-31@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tNXU4-0002Ow-31@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove ts_locale.c's lowerstr()
  In-Reply-To: <E1tNXU4-0002Ow-31@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox