>>>>> "bk" == Boulat Khakimov <[EMAIL PROTECTED]> writes: bk> How do I grant permissions on everything in the selected bk> databes? bk> GRANT doesnt take as on object database name nor does it bk> accept wild chars.... Attached is some Perl code I wrote long ago to do this. This particular code was done for Keystone, a problem tracking database and it would do a "GRANT ALL". Modify it as needed. Last I checked it worked with both PostgreSQL 6.5.x and 7.0.x
#! /usr/bin/perl -w # I'm also appending a Perl script to grant public access to all # keystone tables. It uses the Pg module for PostgreSQL, so you will # need to add that first. However, I find it a bit less tedious than # granting access by hand.... # Roland B. Roberts, PhD Custom Software Solutions # [EMAIL PROTECTED] 101 West 15th St #4NN # [EMAIL PROTECTED] New York, NY 10011 use Pg; if (defined $ARGV[0]) { $dbname = $ARGV[0]; } else { $dbname = "keystone"; } print "connecting to $dbname\n"; $dbh = Pg::connectdb("dbname=$dbname $ARGV[1]"); die "Pg::connectdb failed, $dbh->errorMessage" unless ($dbh->status == PGRES_CONNECTION_OK); $c{relname} = $dbh->exec ("select relname from pg_class where relname !~ '^pg_' and relkind != 'i'"); die "Pg::exec, $dbh->errorMessage" unless ($c{relname}->resultStatus == PGRES_TUPLES_OK); for ($i = 0; $i < $c{relname}->ntuples; $i++) { $relname = $c{relname}->getvalue($i,0); print "grant all on $relname to public\n"; $c{grant} = $dbh->exec ("grant all on $relname to public"); die "Pg::exec, ".$dbh->errorMessage unless ($c{grant}->resultStatus == PGRES_COMMAND_OK); }
roland -- PGP Key ID: 66 BC 3B CD Roland B. Roberts, PhD RL Enterprises [EMAIL PROTECTED] 76-15 113th Street, Apt 3B [EMAIL PROTECTED] Forest Hills, NY 11375
---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])