#! /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 # roberts@panix.com 101 West 15th St #4NN # rbroberts@acm.org 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); }