Skip Menu |
 

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

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

People
Owner: greg [...] turnstep.com
Requestors: alex.cheshev [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 2.15.0



Subject: Arrays are not padded with undef.
Date: Mon, 06 Oct 2008 12:24:49 +1100
To: bug-DBD-Pg [...] rt.cpan.org
From: Alex Cheshev <alex.cheshev [...] gmail.com>
Hello. #!/usr/bin/perl -w use strict "vars"; use DBI; my $dbh = DBI->connect("dbi:Pg:service=wed", "", "", { RaiseError => 1, AutoCommit => 1 }); my @firsts = ("Alex", "Jack"); my @lasts = ("Cheshev", "Black", "White"); my $sth = $dbh->prepare("INSERT INTO test VALUES (?, ?)"); $sth->execute_array(undef, \@firsts, \@lasts); $dbh->disconnect(); DBD::Pg::st execute_array failed: Arrayref for parameter 2 has 3 elements but parameter 1 has 2 at ./guestmanager.pl line 12. DBD::Pg::st execute_array failed: Arrayref for parameter 2 has 3 elements but parameter 1 has 2 at ./guestmanager.pl line 12. Array @firsts was not padded with undef but DBI says that: Where column-wise binding is used (via the |@bind_values| argument or calls to bind_param_array()) the maximum number of elements in any one of the bound value arrays determines the number of tuples executed. *Placeholders with fewer values in their parameter arrays are treated as if padded with undef (NULL) values.* I have to add $#lasts = $#firsts. It is so inconvenient. Version of DBD::Pg is 2.9.0.
Download (untitled) / with headers
text/plain 169b
Thanks for the report, this is confirmed as unwanted behavior. Unfortunately, due the way DBI arranges things, fixing it is not going to be easy. But it's on our radar.
Should be fixed in r13154


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.