Re: how to escape _ in select

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Wes James <comptekki(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: how to escape _ in select
Date: 2010-07-28 20:44:59
Message-ID: AANLkTi=MiHWF3tZK0sPJc=sgnzBupnziPjCyaCYApGyo@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)com>

> On Wed, Jul 28, 2010 at 12:15 PM, Little, Douglas
> <DOUGLAS(dot)LITTLE(at)orbitz(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Kellerer 2010-07-29 07:16:44 Re: how to escape _ in select
Previous Message Wes James 2010-07-28 20:23:15 Re: how to escape _ in select