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: Fix ILIKE patterns with non-ASCII bytes in single-byte encodings
Date: Wed, 21 Oct 2026 12:55:01 +0000
Message-ID: <E1xJVqP-00000000Bm0-2cqB@gemulon.postgresql.org> (raw)

Fix ILIKE patterns with non-ASCII bytes in single-byte encodings.

Commit 1e493158d3d changed the MATCH_LOWER implementation of GETCHAR()
from SB_lower_char() to use pg_ascii_tolower().  The latter returns an
unsigned char; but the local variable in C_IMatchText was a char.

For single-byte encodings and the C locale, that could lead to a
broken signed/unsigned comparison.  For example, the pattern
U&'%\00C6' would never match.

Fix by casting the result of pg_ascii_tolower() explicitly to char.

Reported-by: Greg Burd <greg@burd.me>
Reviewed-by: Greg Burd <greg@burd.me>
Discussion: https://postgr.es/m/_GW2V-rd0QW4BTguAJriA9XVmjOn2mR3-YeAZr9ZU6EtlLvYPEm_r_fV5wGKzSNMzboj_nqn3fk72AYA...
Backpatch-through: 19

Branch
------
REL_19_STABLE

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

Modified Files
--------------
src/backend/utils/adt/like_match.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



view thread (2+ messages)

Message-ID: <E1xJVqP-00000000Bm0-2cqB@gemulon.postgresql.org>
Permalink:  ../E1xJVqP-00000000Bm0-2cqB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xJVqP-00000000Bm0-2cqB@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org
  Subject: Re: pgsql: Fix ILIKE patterns with non-ASCII bytes in single-byte encodings
  In-Reply-To: <E1xJVqP-00000000Bm0-2cqB@gemulon.postgresql.org>
  References: <E1xJVqP-00000000Bm0-2cqB@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