weird quote bug - Mailing list pgsql-general

From Shane Wright
Subject weird quote bug
Date
Msg-id 200306301225.05537.me@shanewright.co.uk
Whole thread Raw
Responses Re: weird quote bug  (Shane Wright <me@shanewright.co.uk>)
Re: weird quote bug  ("alex b." <mailinglists1@gmx.de>)
Re: weird quote bug  (Paul Thomas <paul@tmsl.demon.co.uk>)
Re: weird quote bug  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List pgsql-general
Hi

This is really driving me silly - I can't work it out, can anyone see what I'm doing thats stupid and causing this not
tomatch? 


This shows that the row exists in the table:


emystery=> select aid,useragent from useragent where useragent like '%ntserver-ps%';
    aid    |                                                useragent
-----------+---------------------------------------------------------------------------------------------------------
 875741007 | Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; file://\\ntserver-ps\publicsw\nt\ie6\ins\active.ins)
(1 row)


this tries to select it (note that I've escaped the backslashes):


emystery=> select * from useragent where useragent ilike 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;
file://\\\\ntserver-ps\\publicsw\\nt\\ie6\\ins\\active.ins)';
 aid | useragent | date_added | data_browser | data_version | data_os
-----+-----------+------------+--------------+--------------+---------
(0 rows)


no match!  This one encodes the backslashes (\xxx octal for ASCII value) in a different way:


emystery=> select * from useragent where useragent ilike 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;
file://\134\134ntserver-ps\134publicsw\134nt\134ie6\134ins\134active.ins)';
 aid | useragent | date_added | data_browser | data_version | data_os
-----+-----------+------------+--------------+--------------+---------
(0 rows)


again no match!  And to show that the above queries were correct:


emystery=> select 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;
file://\\\\ntserver-ps\\publicsw\\nt\\ie6\\ins\\active.ins)';
                                                ?column?
---------------------------------------------------------------------------------------------------------
 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; file://\\ntserver-ps\publicsw\nt\ie6\ins\active.ins)
(1 row)

emystery=> select 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0;
file://\134\134ntserver-ps\134publicsw\134nt\134ie6\134ins\134active.ins)';
                                                ?column?
---------------------------------------------------------------------------------------------------------
 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; file://\\ntserver-ps\publicsw\nt\ie6\ins\active.ins)
(1 row)



They are identical!  I can't work out whats going on!  Please, if anyone can see what's wrong it'll stop me careering
intomy early grave! 

Thanks

Shane


pgsql-general by date:

Previous
From: Harry Yau
Date:
Subject: How to fetch the RefCursor in via ODBC??
Next
From: Shane Wright
Date:
Subject: Re: weird quote bug