Re: Bug #480: problem with LIKE pattern matches involving % and \_

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: decius(at)whack(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #480: problem with LIKE pattern matches involving % and \_
Date: 2001-10-12 18:18:51
Message-ID: 27774.1002910731@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2001-10-12 18:22:47 Re: Bug #480: problem with LIKE pattern matches involving
Previous Message Bruce Momjian 2001-10-12 17:53:49 Re: Possible bug in ALTER TABLE RENAME COLUMN (PostgreSQL 7.1.3)