Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 27538
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: ianburrell [...] gmail.com
Cc: imacat [...] cpan.org
AdminCc:

Bug Information
Severity: Important
Broken in: 1.49
Fixed in: 2.7.0



Subject: DBD::Pg escaping corrupts strings with PostgreSQL 8.2 and standard_conforming_strings
PostgreSQL 8.2 added the standard_conforming_strings configuration parameter which causes backslashes to be treated literally in string literals. This corrupts strings in combination with DBD::Pg escaping. DBD::Pg escapes '\a' to '\\a'; that is stored in the database as '\\a'. This corruption seems to happen most obviously with the bytea columns. The PostgreSQL developers have talked about making standard_conforming_strings on the default. The escape_string_warning parameter turned on will warn if the normal string literal is used with backslahs escape with standard_conforming_strings off. One solution is to detect standard_conforming_strings and not escape backslashes. Another is to use the escape string literal syntax (E'\\a') when supported. Until then, it might be good to have a mention that standard_conforming_strings = on should not be used.
Yeah, this one is a doozy, as the quoting happens at a pretty low level, and grabbing the current setting on every connect is expensive to boot. I'll throw something in the docs as suggested until we can find a better solution.
As a note, this problem still exists with DBD-Pg-2.6.0.
On 2007-06-11 17:53:04 Mon, ianburrell@gmail.com wrote: Hi. This is imacat from Taiwan. I did not get test failures on this issue with DBD-Pg 2.6.3 and DBD-Pg 2.6.4 anymore. Does this mean this bug is resolved now?
Show quoted text
> Hi. This is imacat from Taiwan. I did not get test failures on > this issue with DBD-Pg 2.6.3 and DBD-Pg 2.6.4 anymore. Does this mean > this bug is resolved now?
No, we're still working on a solution, but it should be fixed in 2.7.0.