pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: ltree: fix case-insensitive matching.
Date: Tue, 16 Dec 2025 21:00:47 +0000
Message-ID: <E1vVcA2-0017xT-31@gemulon.postgresql.org> (raw)

ltree: fix case-insensitive matching.

Previously, ltree_prefix_eq_ci() used lowercasing with the default
collation; while ltree_crc32_sz() used tolower() directly. These were
equivalent only if the default collation provider was libc and the
encoding was single-byte.

Change both to use casefolding with the default collation.

Backpatch through 18, where the casefolding APIs were introduced. The
bug exists in earlier versions, but would require some adaptation.

A REINDEX is required for ltree indexes where the database default
collation is not libc.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Backpatch-through: 18
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com
Discussion: https://postgr.es/m/01fc00fd66f641b9693d4f9f1af0ccf44cbdfbdf.camel@j-davis.com

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/806555e3000d0b0e0c536c1dc65548128d457d86

Modified Files
--------------
contrib/ltree/crc32.c         | 47 +++++++++++++++++++++++++++++++++++--------
contrib/ltree/lquery_op.c     | 39 ++++++++++++++++++++++++++++++++---
src/include/utils/pg_locale.h | 14 +++++++++++++
3 files changed, 89 insertions(+), 11 deletions(-)



view thread (2+ messages)

Message-ID: <E1vVcA2-0017xT-31@gemulon.postgresql.org>
Permalink:  ../E1vVcA2-0017xT-31@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vVcA2-0017xT-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: jdavis@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: ltree: fix case-insensitive matching.
  In-Reply-To: <E1vVcA2-0017xT-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