Re: LIKE operator and string comparison

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Wei Weng <wweng(at)kencast(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: LIKE operator and string comparison
Date: 2004-09-22 23:20:48
Message-ID: 19719.1095895248@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Wei Weng <wweng(at)kencast(dot)com> writes:
> What about in regular strings? I do need to use backslash to escape the
> other backslash in order to get the '\'. Why isn't that the case in LIKE
> operation?

It is. You write four backslashes in order to describe a string
constant value containing two backslashes. When the LIKE code sees
that, it interprets it as one quoted backslash.

See LIKE ... ESCAPE if you'd like to use a different escape character
in the LIKE pattern.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Kemin Zhou 2004-09-23 15:32:50 plpgsql syntax
Previous Message Wei Weng 2004-09-22 23:19:30 Re: LIKE operator and string comparison