Subject: | DBD::Pg 2.0.0 and above: $dbh->{Name} ne $dbh->{pg_db} is not documented |
Date: | Mon, 13 Apr 2009 00:11:45 +0200 (CEST) |
To: | bug-DBD-Pg [...] rt.cpan.org |
From: | Fritz Zaucker <fritz.zaucker [...] oetiker.ch> |
Hi,
the Database Handle Attributes
Name
and
pg_db
return different values:
Name gives dbname=MyDatabase
whereas
pg_db gives MyDatabase
for a dbh created with a connect(dbi:Pg:dbname=Mydatabase).
In older DBD::Pg versions, namely <2.0.0 andd before, the Name attribute
returned the database name without the leading dbname= (it behaved just like
pg_db does now).
Looking at the documentation of DBI.pm, the current behaviour of Name actually
seems to be correct:
Name (string)
Holds the "name" of the database. Usually (and recommended to be)
the same as the "dbi:DriverName:..." string used to connect to the
database, but with the leading "dbi:DriverName:" removed.
It would be useful to document the difference in behaviour of Name and pg_db
in the DBD::Pg documentation. Currently the difference is not visible:
Name (string, read-only)
Returns the name of the current database.
and
pg_db (string, read-only)
DBD::Pg specific attribute. Returns the name of the current database.
May be even a note pointing out the change towards DBD::PG version <= 2.0.0
(where this was changed according to the CHANGES file) would be useful.
Cheers,
Fritz
--
Oetiker+Partner AG tel: +41 62 775 99 03 (direct)
Fritz Zaucker +41 62 775 99 00 (switch board)
Aarweg 15 +41 79 675 06 30 (mobile)
CH-4600 Olten fax: +41 62 775 99 05
Schweiz web: www.oetiker.ch