Re: GRANT on all tables?

From: Simon Fortelny <sforteln(at)fhcrc(dot)org>
To: dudsen <dudsen(at)koen(dot)dk>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: GRANT on all tables?
Date: 2003-04-23 19:48:55
Message-ID: Pine.GSO.4.44.0304231247540.27528-100000@fred
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Can't remember where I found this but its worked in the past for
granting privileges to all tables in a DB to a user.

./psql -t -A -U $OWNER -W -c "select tablename from pg_tables
where tablename not like 'pg_%'" $mydatabase | xargs -i ./psql -U
$OWNER -W -c "grant ALL on {} to $NEWUSER" $mydatabase

--------------------------------------------------------------------------
Simon Fortelny
Research Technician
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. D4-100
Seattle, WA 98109-1024

tel. 206.667.5618
email. sforteln(at)fred(dot)fhcrc(dot)org

On Wed, 16 Apr 2003, dudsen wrote:

> How do I GRANT an user privileges for all tables in an database with one
> command, as it is now i need to specify the name of each table.
> I want to write something like
> GRANT SELECT,INSERT ON mydatabase TO user; this doesn't work but are there a
> way of getting someting similar to work?
>
> --
> Daniel Udsen
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Gaetano Mendola 2003-04-23 23:36:24 News group
Previous Message Steve Crawford 2003-04-23 18:43:56 Re: Log Output Going to STDERR even with silent mode on