]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix LIKE matching with nondeterministic collations and backslashes.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Jul 2026 18:35:21 +0000 (14:35 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Jul 2026 18:35:21 +0000 (14:35 -0400)
commita99bd8d584ea268d8a3d02d0f0facb74429ffcf9
tree70907202a278cf7974f3b8f149af2223cb3bbd45
parentd0bb49e61168953f0f07c3beeb2b8fb63a3521a2
Fix LIKE matching with nondeterministic collations and backslashes.

Commit 85b7efa1c added support for LIKE with nondeterministic
collations, but it included a bug in the de-escaping logic for
literal pattern substrings.  That unconditionally skipped all
backslashes, but when it encounters '\\' it should emit the second
backslash as a de-escaped character.  That led to acting as though
the escaped backslash was not there.

Bug: #19474
Reported-by: Bowen Shi <zxwsbg12138@gmail.com>
Author: Nitin Motiani <nitinmotiani@google.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Ewan Young <kdbase.hack@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19474-5b86a95f3d9a7ecb@postgresql.org
Discussion: https://postgr.es/m/CAH5HC94yU+K8Gcdy12M5BS8gwD_SXLSHzc9k5tNk7JDnpBiFMA@mail.gmail.com
Backpatch-through: 18
src/backend/utils/adt/like_match.c
src/test/regress/expected/collate.icu.utf8.out
src/test/regress/sql/collate.icu.utf8.sql