dbd:pg finish() bug

From: Vivek Khera <khera(at)kcilink(dot)com>
To: E(dot)Mergl(at)bawue(dot)de, pgsql-bugs(at)postgresql(dot)org
Subject: dbd:pg finish() bug
Date: 2001-05-26 18:42:15
Message-ID: 15119.63751.783572.411703@yertle.kciLink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The DBD::Pg driver doesn't properly reset "Active" state when all data
from a handle is fetched, as specified in the DBI docs under the
description of finish().

This program should not report any warnings with the finish() method
commented out. It however, complains about an active handle during
the destroy.

The sample database is below.

--cut here--
#! /usr/bin/perl
use strict;

use DBI;

&main();

sub main {
my $dbh = DBI->connect('dbi:Pg:dbname=khera','khera',undef,{PrintError=>1})
or die "dbi connect failure: ".$DBI::errstr;

my $sth = $dbh->prepare('select a,b from t1')
or die $dbh->errstr;

$sth->execute();
while (my ($a,$b) = $sth->fetchrow_array()) {
print "a=$a, b=$b\n";
}

print 'active:',$sth->{Active},"\n";
# finish is not necessary according to DBI...
$sth->finish();
print 'active:',$sth->{Active},"\n";

print "--------\n";

$dbh->disconnect();
}
--cut here--

CREATE TABLE "t1" (
"a" integer,
"b" integer
);
COPY "t1" FROM stdin;
1 2
2 3
3 4
\.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Edmund Mergl 2001-05-27 14:15:22 Re: dbd:pg finish() bug
Previous Message Tom Lane 2001-05-26 15:01:30 Re: DROP USER results in backend closure