CREATE USER possible? - Mailing list pgsql-admin

From Adams, Joe
Subject CREATE USER possible?
Date
Msg-id ED7A447524CCD311A9BF009027DC86ED011417C8@NSEXCH02
Whole thread Raw
List pgsql-admin
I am trying to make a administration web page for postgreSQL users. The main
purpose of this web page is to add , remove and modify pgsql users. To do
this I am connecting to a database under the postgres user. The following is
only some of the code being used.

$dataSource="dbi:Pg:dbname=alidb";
$dbh = DBI->connect($dataSource, "postgres", "password");
if($dbh)
{
       $statement = "CREATE USER oadd WITH PASSWORD rspassword";
       #prepare and execute the statment
        $sth = $dbh->prepare($statement);
        $rc = $sth->execute;
        print "USER HAS BEEN ADDED<br>$ADDstatement<br>";
}

From what I understand and from talking to some people on #postgresql it
doesn't matter what DB I connect to, just that the user I connect with has
the rights to create other users.
I've looked for this topic in previous threads and am somewhat confused. Is
what I'm doing the correct approach. If not what would be the right approach
(ie running ./createuser ).

Someone else must have already written this  - - so I'd love to hear from
you.


pgsql-admin by date:

Previous
From: "Geoffrey Gifford"
Date:
Subject: DBI & DBD-Pg
Next
From: "Rob Stoddard"
Date:
Subject: Suffering