pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pgsql-sql <pgsql-sql@fc.emc.com.ph>
To: pgsql-sql@postgresql.org
To: pgsql-general@postgresql.org
To: pgsql-novice@postgresql.org
Date: Wed, 14 Mar 2001 21:10:19 +0800
Message-ID: <fc.000f567200a439d9000f567200a439d9.a43a08@fc.emc.com.ph> (raw)

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

roland@astrofoto.org writes:
>>>>>> "bk" == Boulat Khakimov <boulat@inet-interactif.com> 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
>-- 
>




Message-ID: <fc.000f567200a439d9000f567200a439d9.a43a08@fc.emc.com.ph>
Permalink:  ../fc.000f567200a439d9000f567200a439d9.a43a08@fc.emc.com.ph/
Also on:    postgresql.org/message-id/fc.000f567200a439d9000f567200a439d9.a43a08@fc.emc.com.ph

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: pgsql-sql@fc.emc.com.ph, pgsql-general@postgresql.org, pgsql-novice@postgresql.org
  Subject: Re: 
  In-Reply-To: <fc.000f567200a439d9000f567200a439d9.a43a08@fc.emc.com.ph>
  References: <fc.000f567200a439d9000f567200a439d9.a43a08@fc.emc.com.ph>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox