Re: Using backslash in query - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: Using backslash in query
Date
Msg-id 1065255609.2746.14.camel@fuji.krosing.net
Whole thread Raw
In response to Re: Using backslash in query  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Using backslash in query
List pgsql-hackers
Tom Lane kirjutas R, 03.10.2003 kell 18:34:
> Michael Brusser <michael@synchronicity.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.

Regarding the dollar-quoting discussions -

Will we be able to write the above query as 

SELECT smth. FROM  tbl WHERE WHERE situation LIKE $$%\\%$$;

in 7.4 or is \ still special there ?

if it is then one \ in regex in plpython still needs to be entered as
\\\\\\\\ which has some geek coolness but would not be what I'd prefer
to do on a regular basis.

----------------
Hannu



pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: Dreaming About Redesigning SQL
Next
From: "Darko Prenosil"
Date:
Subject: hr translations