pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Proper quoting of \e
5+ messages / 3 participants
[nested] [flat]

* Proper quoting of \e
@ 2002-04-24 13:12 Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
  0 siblings, 0 replies; 5+ messages in thread

From: Helge Kreutzmann @ 2002-04-24 13:12 UTC (permalink / raw)
  To: pgsql-sql

Hello !
We have a database in SQL_ASCII in postgres 7.2.1 which contains among
other information document titles which are automatically retrieved.
I took care of quoting "`" but recently stumpled about "\e" which I
have problems working with. Example (in psql, but in php it is the same):

SELECT title from written_by where title like 'An equation of state {\%';
title
-------------------------------------------------------------------------------------------------
An equation of state {\em \`a la} Carnahan-Starling for a five-dimensional fluid of hard hyperspheres
(1 row)

works, but if I take one character more (or, later, the entire title),
it does not:

SELECT title from written_by where title like 'An equation of state {\e%';

 title 
-------
(0 rows)

I tried various variations (like \\e and simmilar) and looked through
the interactive docs but did not find anything.
Unfortunately I could not search through the list archives because of
some problems with the backend database.

Thanks for any pointers

           Helge

-- 
Helge Kreutzmann, Dipl.-Phys.               Helge.Kreutzmann@itp.uni-hannover.de
  gpg signed mail preferred    gpg-key: finger kreutzm@rigel.itp.uni-hannover.de
    64bit GNU powered                  http://www.itp.uni-hannover.de/~kreutzm
       Help keep free software "libre": http://www.freepatents.org/

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Proper quoting of \e ?
@ 2002-04-25 10:22 Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
  2002-04-25 15:47 ` Re: Proper quoting of \e ? Bruce Momjian <pgman@candle.pha.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Helge Kreutzmann @ 2002-04-25 10:22 UTC (permalink / raw)
  To: pgsql-sql

Hello !
We have a database in SQL_ASCII in postgres 7.2.1 which contains among
other information document titles which are automatically retrieved.
I took care of quoting "`" but recently stumpled about "\e" which I
have problems working with. Example (in psql, but in php it is the same):

SELECT title from written_by where title like 'An equation of state {\%';
title
-------------------------------------------------------------------------------------------------
An equation of state {\em \`a la} Carnahan-Starling for a five-dimensional fluid of hard hyperspheres
(1 row)

works, but if I take one character more (or, later, the entire title),
it does not:

SELECT title from written_by where title like 'An equation of state {\e%';

 title 
-------
(0 rows)

I tried various variations (like \\e and simmilar) and looked through
the interactive docs but did not find anything.
Unfortunately I could not search through the list archives because of
some problems with the backend database.

Thanks for any pointers

           Helge

-- 
Helge Kreutzmann, Dipl.-Phys.               Helge.Kreutzmann@itp.uni-hannover.de
  gpg signed mail preferred    gpg-key: finger kreutzm@rigel.itp.uni-hannover.de
    64bit GNU powered                  http://www.itp.uni-hannover.de/~kreutzm
       Help keep free software "libre": http://www.freepatents.org/
-- 
Helge Kreutzmann, Dipl.-Phys.               Helge.Kreutzmann@itp.uni-hannover.de
  gpg signed mail preferred    gpg-key: finger kreutzm@rigel.itp.uni-hannover.de
    64bit GNU powered                  http://www.itp.uni-hannover.de/~kreutzm
       Help keep free software "libre": http://www.freepatents.org/

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Proper quoting of \e ?
  2002-04-25 10:22 Proper quoting of \e ? Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
@ 2002-04-25 15:47 ` Bruce Momjian <pgman@candle.pha.pa.us>
  2002-04-25 15:57   ` Re: Proper quoting of \e ? Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
  0 siblings, 1 reply; 5+ messages in thread

From: Bruce Momjian @ 2002-04-25 15:47 UTC (permalink / raw)
  To: Helge Kreutzmann <kreutzm@itp.uni-hannover.de>; +Cc: pgsql-sql

Helge Kreutzmann wrote:
-- Start of PGP signed section.
> Hello !
> We have a database in SQL_ASCII in postgres 7.2.1 which contains among
> other information document titles which are automatically retrieved.
> I took care of quoting "`" but recently stumpled about "\e" which I
> have problems working with. Example (in psql, but in php it is the same):
> 
> SELECT title from written_by where title like 'An equation of state {\%';
> title
> -------------------------------------------------------------------------------------------------
> An equation of state {\em \`a la} Carnahan-Starling for a five-dimensional fluid of hard hyperspheres
> (1 row)
> 
> works, but if I take one character more (or, later, the entire title),
> it does not:
> 
> SELECT title from written_by where title like 'An equation of state {\e%';

I noticed you escaped the % in the first query, but not the second.  No
idea how that effects things.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Proper quoting of \e ?
  2002-04-25 10:22 Proper quoting of \e ? Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
  2002-04-25 15:47 ` Re: Proper quoting of \e ? Bruce Momjian <pgman@candle.pha.pa.us>
@ 2002-04-25 15:57   ` Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
  2002-04-25 16:23     ` Re: Proper quoting of \e ? Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Helge Kreutzmann @ 2002-04-25 15:57 UTC (permalink / raw)
  To: pgsql-sql

On Thu, Apr 25, 2002 at 11:47:16AM -0400, Bruce Momjian wrote:
> > I took care of quoting "`" but recently stumpled about "\e" which I
> > have problems working with. Example (in psql, but in php it is the same):
> > 
> > SELECT title from written_by where title like 'An equation of state {\%';
> > title
> > -------------------------------------------------------------------------------------------------
> > An equation of state {\em \`a la} Carnahan-Starling for a five-dimensional fluid of hard hyperspheres
> > (1 row)
> > 
> > works, but if I take one character more (or, later, the entire title),
> > it does not:
> > 
> > SELECT title from written_by where title like 'An equation of state {\e%';
> 
> I noticed you escaped the % in the first query, but not the second.  No
> idea how that effects things.

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.

Greetings

          Helge
-- 
Helge Kreutzmann, Dipl.-Phys.               Helge.Kreutzmann@itp.uni-hannover.de
  gpg signed mail preferred    gpg-key: finger kreutzm@rigel.itp.uni-hannover.de
    64bit GNU powered                  http://www.itp.uni-hannover.de/~kreutzm
       Help keep free software "libre": http://www.freepatents.org/

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Proper quoting of \e ?
  2002-04-25 10:22 Proper quoting of \e ? Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
  2002-04-25 15:47 ` Re: Proper quoting of \e ? Bruce Momjian <pgman@candle.pha.pa.us>
  2002-04-25 15:57   ` Re: Proper quoting of \e ? Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
@ 2002-04-25 16:23     ` Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Joe Conway @ 2002-04-25 16:23 UTC (permalink / raw)
  To: Helge Kreutzmann <kreutzm@itp.uni-hannover.de>; +Cc: pgsql-sql

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







^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2002-04-25 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-24 13:12 Proper quoting of \e Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
2002-04-25 10:22 Proper quoting of \e ? Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
2002-04-25 15:47 ` Re: Proper quoting of \e ? Bruce Momjian <pgman@candle.pha.pa.us>
2002-04-25 15:57   ` Re: Proper quoting of \e ? Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
2002-04-25 16:23     ` Re: Proper quoting of \e ? Joe Conway <mail@joeconway.com>

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