Re: sql: "LIKE" problem - Mailing list pgsql-sql

From Tom Lane
Subject Re: sql: "LIKE" problem
Date
Msg-id 6086.1110785532@sss.pgh.pa.us
Whole thread Raw
In response to sql: "LIKE" problem  ("Her Goo" <gu_he@msn.com>)
List pgsql-sql
"Her Goo" <gu_he@msn.com> writes:
> I want to go a step further, and  restrict the results to those 
> that begin with string "abc\d".

You need four backslashes for that, because \ is special to both
the string literal parser and the LIKE operator.  So '\\\\'
reduces to a string constant containing \\, and then the LIKE
operator sees that as a quoted backslash.
        regards, tom lane


pgsql-sql by date:

Previous
From: pginfo
Date:
Subject: lower and unicode
Next
From: Miroslav Šulc
Date:
Subject: Re: lower and unicode