pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Huxton <dev@archonet.com>
Cc: Campbell, Lance <lance@uiuc.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: Like problem
Date: Wed, 13 Feb 2008 11:52:41 -0500
Message-ID: <16828.1202921561@sss.pgh.pa.us> (raw)
In-Reply-To: <47B31DEC.5050109@archonet.com>
References: <B10E6810AC2A2F4EA7550D072CDE8760197EF2@SAB-FENWICK.sab.uiuc.edu>
	<47B31DEC.5050109@archonet.com>

Richard Huxton <dev@archonet.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



view thread (7+ messages)  latest in thread

Message-ID: <16828.1202921561@sss.pgh.pa.us>
Permalink:  ../16828.1202921561@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16828.1202921561@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dev@archonet.com, lance@uiuc.edu
  Subject: Re: Like problem
  In-Reply-To: <16828.1202921561@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox