pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wei Weng <wweng@kencast.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: LIKE operator and string comparison
Date: Wed, 22 Sep 2004 19:20:48 -0400
Message-ID: <19719.1095895248@sss.pgh.pa.us> (raw)
In-Reply-To: <41520882.6020702@kencast.com>
References: <415202B6.7060903@kencast.com>
	<19606.1095894584@sss.pgh.pa.us>
	<41520882.6020702@kencast.com>

Wei Weng <wweng@kencast.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



view thread (4+ messages)

Message-ID: <19719.1095895248@sss.pgh.pa.us>
Permalink:  ../19719.1095895248@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19719.1095895248@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, wweng@kencast.com
  Subject: Re: LIKE operator and string comparison
  In-Reply-To: <19719.1095895248@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox