Re: Bug #480: problem with LIKE pattern matches involving % and \_ - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #480: problem with LIKE pattern matches involving % and \_
Date
Msg-id 27774.1002910731@sss.pgh.pa.us
Whole thread Raw
In response to Bug #480: problem with LIKE pattern matches involving % and \_  (pgsql-bugs@postgresql.org)
List pgsql-bugs
pgsql-bugs@postgresql.org writes:
> The following pattern matches do not work:

> LIKE '%\_%'
> LIKE '%\_'
> LIKE '\_%'

You are short a backslash: what the LIKE operator is seeing is just
%_%, etc, which naturally matches anything.  You gotta double the
backslashes, because one backslash will be eaten by the string-literal
parser.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Bug #480: problem with LIKE pattern matches involving
Next
From: Bruce Momjian
Date:
Subject: Re: Bug #477: path ?# path