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


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

The fact the DBD::Pg in your case returns the correct database name,

We are in complete agreement. You just didn't read my post well ;-) I log 'passwordless' into postgres with PGPASSFILE and friends (PGHOST, PGPORT, PGDATABASE), so my $dbh->{'Name'} returns empty.

(and btw, your example ("dbi:Pg:dbname=test", ...) will return not 'test', but 'dbname=test', although I suppose you understand that. (Apparently DBD::Pg was actually changed a while ago to give this DBI-compliant behavior, instead of the database name.))