Brian Hirt wrote:
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
I'm suffering from a similar problem I have turned on standard_conforming_strings to stop the deluge of warning messages that I was getting from postgres 8.2 but now with $dbh->quote() I cannot do round trips to the database and get back what I put in. Unfortunatly a simple s{\\\\}{\\}g regular expression on the output does not universally fix the problem.

Is there a way to tell DBD::Pg to quote using standards conforming? I understand that DBD::Pg provides the $dbh->quote function.


Ivan

Reply via email to