Skip site navigation (1) Skip section navigation (2)

Re: Using backslash in query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: michael(at)synchronicity(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Using backslash in query
Date: 2003-10-03 15:34:04
Message-ID: 19903.1065195244@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Michael Brusser <michael(at)synchronicity(dot)com> writes:
> But when I doubled the number of backslashes:
>   SELECT smth. FROM  tbl WHERE situation LIKE '%\\\\%';
> - it actually worked fine.

Backslash is special to both the string-literal parser and the LIKE code.
So when you write the above, the pattern value that arrives at the LIKE
processor has one less level of backslashing:
	%\\%
and the LIKE processor interprets this as percent, a literal backslash,
and another percent.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Rod TaylorDate: 2003-10-03 15:35:28
Subject: Re: Oracle/PostgreSQL incompatibilities
Previous:From: scott.marloweDate: 2003-10-03 15:24:18
Subject: Re: Question regarding coopting Database Engine

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group