pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pavel@bnovo.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15421: Error: LIKE pattern must not end with escape character
Date: Fri, 05 Oct 2018 10:08:57 -0400
Message-ID: <4710.1538748537@sss.pgh.pa.us> (raw)
In-Reply-To: <15421-6e32dfa391cfae4a@postgresql.org>
References: <15421-6e32dfa391cfae4a@postgresql.org>

=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> If I try to query the table with LIKE statement:
> SELECT COUNT(id) AS "records_found" FROM "tmp" WHERE lower("tmp"."name")
> LIKE 't\' I get the error "Error: LIKE pattern must not end with escape
> character".
> If I try to query the statement SELECT COUNT(id) AS "records_found" FROM
> "tmp" WHERE lower("tmp"."name") LIKE 'rs\' and others that do not match any
> records, there are no errors at all.

Yeah, the pattern is wrong, but the error is only detected if scanning of
the pattern reaches the end, which it won't if the match always fails
before that.

This has been complained of several times before, but it's something
that doesn't seem worth taking any performance hit for.  It's possible
that something along the lines of what I sketched in
https://www.postgresql.org/message-id/28169.1489781085@sss.pgh.pa.us
would be close enough to zero net cost to be OK.  Nobody's pursued it
though.

			regards, tom lane




view thread (2+ messages)

Message-ID: <4710.1538748537@sss.pgh.pa.us>
Permalink:  ../4710.1538748537@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4710.1538748537@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pavel@bnovo.ru
  Subject: Re: BUG #15421: Error: LIKE pattern must not end with escape character
  In-Reply-To: <4710.1538748537@sss.pgh.pa.us>
  References: <15421-6e32dfa391cfae4a@postgresql.org> <4710.1538748537@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox