Skip Menu |

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

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

People
Owner: dwheeler [...] cpan.org
Requestors: cpan [...] ali.as
Cc: dwheeler [...] cpan.org
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.22
Fixed in: 1.31



Subject: Bad calls to ph_server_version
It's nice to see the new version of DBD::Pg caches the server version calls, but there's a couple of very obvious bugs you've missed. Line 911 in sub table_attributes... you don't fully reference the sub name correctly. my $version = pg_server_version( $dbh ); should be my $version = DBD::Pg::pg_server_version( $dbh ); Secondly, you should probably cache a failure to get the version, to avoid repeatedly attempting. ## Used by both the dr and db packages sub pg_server_version { my $dbh = shift; return $dbh->{pg_server_version} if defined $dbh->{pg_server_version}; my ($version) = $dbh->selectrow_array("SELECT version();"); return 0 unless $version =~ /^PostgreSQL ([\d\.]+)/; $dbh{pg_server_version} = $1; return $dbh{pg_server_version}; } should become sub pg_server_version { my $dbh = shift; return $dbh->{pg_server_version} if defined $dbh->{pg_server_version}; my ($version) = $dbh->selectrow_array("SELECT version();"); $dbh{pg_server_version} = $version =~ /^PostgreSQL ([\d\.]+)/ ? $1 : 0; return $dbh{pg_server_version}; } And thirdly, while I haven't tested it, I have doubts about whether my $version = $dbh->pg_server_version; would work as well... ( in foreign_key_info )
david wheeler (dwheeler@cpan.org) is the active and very capable maintainer of DBD::Pg. I gave maintainership to him months ago. Why do I continue to be the first contact for these bugs? I think it is a bug in CPAN/rt. David I have marked you as the owner on this request.