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