Re: how to escape _ in select - Mailing list pgsql-sql

From Tom Lane
Subject Re: how to escape _ in select
Date
Msg-id 20369.1280342060@sss.pgh.pa.us
Whole thread Raw
In response to how to escape _ in select  (Wes James <comptekki@gmail.com>)
List pgsql-sql
Wes James <comptekki@gmail.com> writes:
> I'm trying to do this:
> select * from table where field::text ilike '%\_%';

> but it doesn't work.

You need to double the backslash, because one level of
backslash-escaping will be eaten by the string literal parser.
In the above example, the actual string value seen by ILIKE
is just %_%, so of course it doesn't do what you want.
        regards, tom lane


pgsql-sql by date:

Previous
From: Wes James
Date:
Subject: Re: how to escape _ in select
Next
From: Wes James
Date:
Subject: Re: how to escape _ in select