Re: [PATCH] Fix for bug #19474: LIKE fails to match literal backslashes with nondeterministic collations

From: Nitin Motiani <nitinmotiani(at)google(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ewan Young <kdbase(dot)hack(at)gmail(dot)com>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix for bug #19474: LIKE fails to match literal backslashes with nondeterministic collations
Date: 2026-07-06 18:48:43
Message-ID: CAH5HC96PgZNCTPmfmkP1GmOtV=eWhxn4T0zZjOTCQd_SGAk3ng@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jul 4, 2026 at 3:03 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> I don't think this patch is ready. It is wasting code and cycles to
> fix a nonexistent problem. We are working in a backend-safe encoding,
> therefore it is not possible for one byte of a multibyte character to
> match '\' (nor '_' nor '%'). So the existing logic that pays no
> attention to multibyte boundaries is not wrong, and if it were then
> the preceding loop that looks for the end of the literal-match
> substring would also be wrong (as well as some hundreds of other
> places that make similar assumptions).
>
> This code does get consecutive-backslash cases wrong, and we need
> to fix that, but we don't need to add complexity to fix something
> that's not broken.
>

Thanks for the feedback, Tom. I have removed the logic for the
multibyte check and simplified the code. Please take a look at the
latest patch.

Regards,
Nitin Motiani
Google

Attachment Content-Type Size
v4-0001-Fix-LIKE-matching-with-nondeterministic-collation.patch application/x-patch 4.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Rachitskiy 2026-07-06 18:50:21 [PATCH] Collapse consecutive .** accessors for jsonpath exists queries
Previous Message Robert Haas 2026-07-06 18:40:23 Re: Proposal: Conflict log history table for Logical Replication