you can also do it by a shell script

grantall.sh:
###### start of grantall.sh #######
#!/bin/ash
SQL="SELECT relname FROM pg_class WHERE (relkind = 'r' OR relkind = 'S')
AND relname !~ '^pg_' ORDER BY relname"
OBJ=`psql -t -c "${SQL}" $1`
# OBJ=`echo ${OBJ} | sed 's/EOF//g'`
OBJ=`echo ${OBJ} | sed 's/ /, /g'`
# SQL="REVOKE ALL ON ${OBJ} FROM PUBLIC"
SQL="GRANT ALL ON ${OBJ} TO PUBLIC"
echo ${SQL}
psql -c "${SQL}" $1   
###### end of grantall.sh #######

syntax: grantall.sh name_of_database

sherwin

[EMAIL PROTECTED] writes:
>>>>>> "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
>
>
>roland
>-- 
>


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to