pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Proper quoting of \e ?
Date: Thu, 25 Apr 2002 09:23:01 -0700
Message-ID: <3CC82D65.9010809@joeconway.com> (raw)
References: <20020425122253.A29150@itp.uni-hannover.de>
	<200204251547.g3PFlG317946@candle.pha.pa.us>
	<20020425175718.B31354@itp.uni-hannover.de>

Helge Kreutzmann wrote:
> Well, the "\" is part of the strings to be outputed, so I did not
> intend to quota anything. If I replace \ to \\ in my first query, I
> get also no result.
> 

I think you need 4 '\'s:

test=# create table written_by(title text);
CREATE
test=# insert into written_by values('An equation of state {\\em \\\`a 
la} Carnahan-Starling');
INSERT 16661 1
test=# select * from written_by;
                         title
-----------------------------------------------------
  An equation of state {\em \`a la} Carnahan-Starling
(1 row)

test=# SELECT title from written_by where title like 'An equation of 
state {\\\\e%';
                         title
-----------------------------------------------------
  An equation of state {\em \`a la} Carnahan-Starling
(1 row)


This is because the string literal parser reduces '\\\\' to '\\', and 
then the backend function which implements LIKE interprets '\\' as '\'.

HTH,

Joe







view thread (5+ messages)

Message-ID: <3CC82D65.9010809@joeconway.com>
Permalink:  ../3CC82D65.9010809@joeconway.com/
Also on:    postgresql.org/message-id/3CC82D65.9010809@joeconway.com

 · 

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: mail@joeconway.com, kreutzm@itp.uni-hannover.de
  Subject: Re: Proper quoting of \e ?
  In-Reply-To: <3CC82D65.9010809@joeconway.com>

* 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