Re: BUG #15084: Invalid LIKE pattern not always reported

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: tudorb(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15084: Invalid LIKE pattern not always reported
Date: 2018-02-23 20:51:41
Message-ID: 23731.1519419101@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

=?utf-8?q?PG_Bug_reporting_form?= <noreply(at)postgresql(dot)org> writes:
> PostgreSQL will not always detect an invalid LIKE pattern (one that ends
> with a backslash).
> This probably happens because the pattern is only parsed lazily (as needed);
> if PostgreSQL detects that a match is impossible, it doesn't even look at
> the rest of the pattern.

Yeah, exactly.

> Still, it would be nice for error reporting to be consistent.

This has been discussed before, but nobody could see how to do it without
taking a performance hit (ie, doing a full scan of the pattern before
doing any actual work). It didn't seem worth that.

It occurs to me that we could make the behavior more consistent by
redefining a trailing backslash as something we silently ignore, instead
of raising an error. Not sure if that's an improvement, though.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Gould 2018-02-23 21:36:27 Re: maximum for auto_explain.log_min_duration doesn't seem to make sense
Previous Message David G. Johnston 2018-02-23 20:43:30 Re: BUG #15084: Invalid LIKE pattern not always reported