Re: BUG #19699: LIKE with a trailing escape fails to raise SQLSTATE 22025 for empty input - Mailing list pgsql-bugs

From shihao zhong
Subject Re: BUG #19699: LIKE with a trailing escape fails to raise SQLSTATE 22025 for empty input
Date
Msg-id CAGRkXqRRPPdcXt1KjeG+Nj61ar9Cnp8G6XTDY-dmToo_HYqNFA@mail.gmail.com
Whole thread
In response to Re: BUG #19699: LIKE with a trailing escape fails to raise SQLSTATE 22025 for empty input  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-bugs by date:

Previous
From: Palak Chaturvedi
Date:
Subject: Re: BUG #19701: GIN trigram index loses rows at similarity_threshold 0
Next
From: Ludvig Janiuk
Date:
Subject: Re: 42P16 error when dropping and adding column