Re: BUG #19699: LIKE with a trailing escape fails to raise SQLSTATE 22025 for empty input

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: imchifan(at)163(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19699: LIKE with a trailing escape fails to raise SQLSTATE 22025 for empty input
Date: 2026-09-25 13:35:37
Message-ID: CAGRkXqRRPPdcXt1KjeG+Nj61ar9Cnp8G6XTDY-dmToo_HYqNFA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Tom,

> This claim is unsubstantiated. Even if it were, I fail to understand
> why it's necessary to expend any cycles whatsoever on this point.
> Who cares if we don't throw that error?

You're right that it isn't cheap as written. After a %, each candidate
position in the text gets its own recursive call, and each call repeats
the check. Checking once before the recursion would fix that.

But I agree with your main point. Even a cheap check buys nothing. A
bad pattern just returns false, and both reports were only about the
inconsistency. So I'm dropping the patch.

Thanks,
Shihao

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Manu 2026-09-25 15:38:08 Re: BUG #19701: GIN trigram index loses rows at similarity_threshold 0
Previous Message Palak Chaturvedi 2026-09-25 09:09:41 Re: BUG #19701: GIN trigram index loses rows at similarity_threshold 0