Re: how to escape _ in select - Mailing list pgsql-sql

From Dmitriy Igrishin
Subject Re: how to escape _ in select
Date
Msg-id AANLkTi=MiHWF3tZK0sPJc=sgnzBupnziPjCyaCYApGyo@mail.gmail.com
Whole thread Raw
In response to Re: how to escape _ in select  (Wes James <comptekki@gmail.com>)
List pgsql-sql
Hey James,

Because in future releases the default value of the "standard_conforming_strings"
parameter will change to "on" for improved standards compliance.
You should use string constants with C-Style escapes.
Please, see
http://www.postgresql.org/docs/8.4/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS
for details.

Regards,
Dmitriy

2010/7/29 Wes James <comptekki@gmail.com>
On Wed, Jul 28, 2010 at 12:15 PM, Little, Douglas
<DOUGLAS.LITTLE@orbitz.com> wrote:
> Wes.
>
> You probably missed the part in bold.   You need to double the backslash.
>
> select 'ab5c' like '%\_c'
>
> t
>

Why doesn't this work?

select * from table where field::text ilike '%\\\%'

WARNING:  nonstandard use of \\ in a string literal

-wes

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

pgsql-sql by date:

Previous
From: Wes James
Date:
Subject: Re: how to escape _ in select
Next
From: Thomas Kellerer
Date:
Subject: Re: how to escape _ in select