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

From Tom Lane
Subject Re: Using backslash in query
Date
Msg-id 19903.1065195244@sss.pgh.pa.us
Whole thread Raw
In response to Using backslash in query  (Michael Brusser <michael@synchronicity.com>)
Responses Re: Using backslash in query
List pgsql-hackers
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.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] HeapTuple->t_tableOid==0 after SPI_exec
Next
From: Rod Taylor
Date:
Subject: Re: Oracle/PostgreSQL incompatibilities