I got a column of type bytea, and found out that DBD::Pg is
complaining when it sees backslashes. I'm using prepare/execute and
was under the impression that values added that way were automatically
escaped/quoted by DBI, but i have to s/\\/\\\\/g; to escape the
backslashes (do i need to escape anything else?).


$sth = $dbh->prepare ("INSERT INTO foo (mybytea) VALUES (?);");
$sth->execute ($data);


DBD::Pg::st execute failed: ERROR:  Bad input string for type bytea at
./p.pl line 99, <STDIN> line 1.


I also tried whats pointed out in the man page:

$sth = $dbh->prepare ("INSERT INTO foo (mybytea) VALUES (?);");
$sth->bind_param (1, $data, { pg_type => DBD::Pg::PG_BYTEA });
$sth->execute ($data);

but it didnt work (column is 5 in real code)

Can't bind :p5, pg_type 0 not supported by DBD::Pg at ./p.pl line 101,
<STDIN> line 1.


Confusedly yours,  (please CC)
-- 
Ragnar Hojland - Project Manager
Linalco "Specialists in Linux and Free Software"
http://www.linalco.com Tel: +34-91-5970074 Fax: +34-91-5970083

Reply via email to