http://www.perlmonks.org?node_id=943522


in reply to Re: DBI:how to get name of the db ?
in thread DBI:how to get name of the db ?

It turns out that $dbh->{'Name'} is not a reliable source for the database name; DBI docs say:

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.

DBD::Pg complies wth that description: it simply returns the connectionstring minus the prefix.

So it would seem that if $dbh->{'Name'} returns the database name it's by accident.