Re: sql: "LIKE" problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Her Goo" <gu_he(at)msn(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: sql: "LIKE" problem
Date: 2005-03-14 07:32:12
Message-ID: 6086.1110785532@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Her Goo" <gu_he(at)msn(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Miroslav Šulc 2005-03-14 08:15:14 Re: lower and unicode
Previous Message Her Goo 2005-03-14 06:16:19 sql: "LIKE" problem