Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: siracusa [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.0.0
Fixed in: 2.1.0



Subject: $sth->bind_col(...) does not work with array columns
The following script demonstrates the bug: --- #!/usr/bin/perl use strict; use DBI; my $dbh = DBI->connect('dbi:Pg:dbname=test', 'myuser', 'mysecret', { AutoCommit => 1, RaiseError => 1 }); $dbh->do('CREATE TABLE array_test (id int, nums INT[])'); $dbh->do(q(INSERT INTO array_test (id, nums) VALUES (1, '{1,2,3}'))); my $sth = $dbh->prepare('SELECT id, nums FROM array_test'); $sth->execute; my($id, $nums); $sth->bind_col(1, \$id); $sth->bind_col(2, \$nums); $sth->fetch; print "DBD::Pg version $DBD::Pg::VERSION\n"; print "id: $id, nums: $nums\n"; $sth->finish; $dbh->do('DROP TABLE array_test'); $dbh->disconnect; --- It works correctly with DBD::Pg version 1.49, printing: DBD::Pg version 1.49 id: 1, nums: {1,2,3} but with DBD::Pg, it prints the following: DBD::Pg version 2.0.0 id: 1, nums: Setting $dbh->{'pg_expand_array'} = 0 is a workaround, but bind_col() should definitely work even if pg_expand_array is turned on. Since this is the default, it is even more important that this bug get fixed.
From: greg [...] turnstep.com
Thanks for the report and test script. A possible fix has been committed in r10773: please test if you can.
From: siracusa [...] gmail.com
On Sun Feb 17 15:50:42 2008, greg@turnstep.com wrote: Show quoted text
> Thanks for the report and test script. A possible fix has been committed > in r10773: please test if you can.
This bug appears to be fixed in 2.1.0 and later.