Hi all,

I can't seem to make a valid DBI connection to PostgreSQL 7.1 unless my current
login name matches a Postgresql user.  It seems to ignore the username I'm
passing it.  The initial problem came up under mod_perl and HTML::Mason, but
I've duplicated it in a plain script as well, narrow it down.  Here's a snippet:

use DBI;
use DBD::Pg;
my $dbh;

$dbh = DBI->connect("dbi:Pg:dbname=mydb", "www", "secret") || die $dbh->errstr;
[code to select a record follows this, but it never gets that far]

The error message is:

DBI->connect(dbname=mydb) failed: FATAL 1: user "root" does not exist at testdbi
line [line number with the connect statement]

In Postgresql, two users are defined: my own linux username, and "www" for web
access.  "www" doesn't have a unix account, just exists in Postgresql with
appropriate permissions.  Web clients connect as "nobody".  When I was testing
Mason code, the error message said that "nobody" doesn't exist.  The above
snippet works fine if I'm logged in as me, since my login also exists in the
database.  Do I need to go into PostgreSQL and grant permissions to "nobody" so
it will match the logged-in user, or is there a way to get it to pay attention
to the connect() parms?

Version info:
DBI: 1.15
DBD::Pg: 0.96
PostgreSQL:    7.1

Thanks for your help.



Reply via email to