Bug in DBD::Pg 1.32 with bytea columns

From: Sam Vilain (sam_at_vilain.net)
Date: 12/23/04

  • Next message: Jim Byrne: "Trying to install DBI-1.32 on Raq3: Test returned status 20 (wstat 5120, 0x1400)"
    Date: Thu, 23 Dec 2004 20:47:59 +1300
    To: Dbi-Users <dbi-users@perl.org>
    
    

    "\" characters in bytea columns are not being escaped correctly;

    --- |-
    use DBI;

    $dbh = DBI->connect('dbi:Pg:dbname=tangram', "samv", "") or die
    $DBI::errstr;

    $dbh->do( << "SQL");
    CREATE TABLE foo
    (
       foo BYTEA
    )
    SQL

    my $sth = $dbh->prepare("update foo set foo=?") or die $DBI::errstr;

    $sth->execute("Hello There")
             or die $DBI::errstr;

    $sth->execute("Hello There\\");
             or die $DBI::errstr;

    $dbh->disconnect;
    ...

    The error message is:
    DBD::Pg::st execute failed: ERROR: invalid input syntax for type bytea
    at test.pl line 18.
    ERROR: invalid input syntax for type bytea at test.pl line 18.

    Is this going to be possible to fix in the DBD driver without using
    bind_param?

    I'm on Pg 7.4.3

    -- 
    Sam Vilain, sam /\T vilain |><>T net, PGP key ID: 0x05B52F13
    (include my PGP key ID in personal replies to avoid spam filtering)
    

  • Next message: Jim Byrne: "Trying to install DBI-1.32 on Raq3: Test returned status 20 (wstat 5120, 0x1400)"