quote(), standard_conforming_strings backslash_quote

Brian Hirt <[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
I have standard_conforming_strings set on and backslash_quote set off  
for one of my dev servers.  According to the pg docs (http:// 
www.postgresql.org/docs/8.2/static/runtime-config-compatible.html),  
eventually these options will default to on so I want to get a head  
start on testing.  I'm run into something that I'm not sure how to  
handle.

when I do $dbh->quote("...\'...") "...''..."  is returned.  I would  
expect "...\''..."  to be returned since \' is not a recognized  
escape string with backslash_quote on.  DBD::Pg thinks \' should be  
'' which is not true in this case.  Also, if  
standard_conforming_strings is turned on, \ never needs to be escaped  
since it is no longer an escape character unless it's used in sql  
escape strings (E'...').  There also seems to be to no way in DBD::Pg  
to quote an (E'...') string and quote an ('...') string.  For example  
if i actually want the escape string (E'\b') there appears no way to  
do so, because passing '\b' to quote() returns '\\b' which is will  
not work.  Furthermore if I actually want the text \b in  
standard_conforming_strings quote() will return '\\b' which is also  
wrong since \ isn't an escape character in  
standard_conforming_strings and doesn't need to be escaped.

What are the future plans with DBD::Pg to support quoting standard  
conforming strings and standards conforming escape strings?

--brian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.