Skip Menu |

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

Report information
The Basics
Id: 107763
Status: rejected
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: felipe [...] felipegasper.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: connect() not accepting dbname in attrs hash
Date: Wed, 14 Oct 2015 00:13:19 -0500
To: bug-DBD-Pg [...] rt.cpan.org
From: Felipe Gasper <felipe [...] felipegasper.com>
Observe that the attrs hashref in the first example doesn’t affect the actual database logged into. Show quoted text
> perl -MData::Dumper -MDBI -e'my $dbh = DBI->connect("dbi:Pg:",
"postgres", undef, { dbname => "mortal_nouveau" } ); print Dumper( $dbh->selectall_arrayref("select current_database()") )' $VAR1 = [ [ 'postgres' ] ]; Only when $ENV{PGDATABASE} is set does the expected behavior happen: Show quoted text
> perl -MData::Dumper -MDBI -e'$ENV{PGDATABASE} = "mortal_nouveau"; my
$dbh = DBI->connect("dbi:Pg:", "postgres", undef, { dbnam => "mortal_nouveau" } ); print Dumper( $dbh->selectall_arrayref("select current_database()") )' $VAR1 = [ [ 'mortal_nouveau' ] ]; This is DBD::Pg version 3.5.3.
The DBI docs seem to indicate that only the username and password can be set in the %attr hash (along with PrintError, RaiseError, etc.). Is there a reason you would expect the dbname to work?
Subject: Re: [rt.cpan.org #107763] connect() not accepting dbname in attrs hash
Date: Fri, 31 Mar 2017 10:48:59 -0400
To: bug-DBD-Pg [...] rt.cpan.org
From: Felipe Gasper <felipe [...] felipegasper.com>
I can’t find where but I’ve definitely seen something where “db”, “dbname”, and “database” named parameters were all considered coequal named attributes to specify the db to the driver. I could have sworn that was in DBI, but all I find there is that DSNs should accept “database“ and “db” as aliases, not “dbname”. Fair enough. -F Show quoted text
> On Mar 31, 2017, at 10:22 AM, Greg Sabino Mullane via RT <bug-DBD-Pg@rt.cpan.org> wrote: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=107763 > > > The DBI docs seem to indicate that only the username and password can be set in the %attr hash (along with PrintError, RaiseError, etc.). Is there a reason you would expect the dbname to work? > >
Ok, closing. Feel free to reopen if you feel strong about it or find code in the while that needs that particular behavior.