From: | "Campbell, Lance" <lance(at)uiuc(dot)edu> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Richard Huxton" <dev(at)archonet(dot)com> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Like problem |
Date: | 2008-02-13 17:02:30 |
Message-ID: | B10E6810AC2A2F4EA7550D072CDE8760197EF4@SAB-FENWICK.sab.uiuc.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Tom,
>From your comments the recommended approach moving forward would be to
use ESCAPE and define your escape character?
Thanks for your help,
Lance Campbell
Project Manager/Software Architect
Web Services at Public Affairs
University of Illinois
217.333.0382
http://webservices.uiuc.edu
-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Wednesday, February 13, 2008 10:53 AM
To: Richard Huxton
Cc: Campbell, Lance; pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Like problem
Richard Huxton <dev(at)archonet(dot)com> writes:
> Campbell, Lance wrote:
>> WARNING: nonstandard use of escape in a string literal
>> LINE 1: ...ct c1 from t1 where c1 like '%abc\_%';
> Either indicate you are using an escaped string: LIKE E'%abc\_%'
Actually that's wrong, what he'd need is LIKE E'%abc\\_%'
(or omit the E and ignore the warning).
Alternatively, set standard_conforming_strings to TRUE and write
LIKE '%abc\_%' ... but beware that that might break other parts
of your app that are expecting backslash to be special.
> Or, change the escape character: LIKE '%abcQ_%' ESCAPE 'Q'
Yeah, this might be the easiest localized solution.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Campbell, Lance | 2008-02-13 17:03:00 | Re: Like problem |
Previous Message | Campbell, Lance | 2008-02-13 16:59:14 | Re: Like problem |