BUG #15084: Invalid LIKE pattern not always reported

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: tudorb(at)gmail(dot)com
Subject: BUG #15084: Invalid LIKE pattern not always reported
Date: 2018-02-23 20:29:15
Message-ID: 151941775547.1463.3686411361406861190@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15084
Logged by: Tudor Bosman
Email address: tudorb(at)gmail(dot)com
PostgreSQL version: 9.5.11
Operating system: Ubuntu 16.04
Description:

PostgreSQL will not always detect an invalid LIKE pattern (one that ends
with a backslash).

Example:

tudor=# select 'foo' like 'foo\';
?column?
----------
f
(1 row)

tudor=# select 'foobar' like 'foo\';
ERROR: LIKE pattern must not end with escape character

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.

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

Thanks,
-Tudor.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2018-02-23 20:43:30 Re: BUG #15084: Invalid LIKE pattern not always reported
Previous Message Tom Lane 2018-02-23 20:12:31 Re: BUG #15082: PostgreSQL 11 dev bug with window range partition by QUERY