Re: grant select on all tables of a schema

From: Dani Oderbolz <oderbolz(at)ecologic(dot)de>
To: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: grant select on all tables of a schema
Date: 2003-06-18 08:47:58
Message-ID: 3EF0273E.10301@ecologic.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Nabil Sayegh wrote:

>Hi,
>
>is it possible to 'GRANT <WHATEVER> ON ALL TABLES' in 1 command ?
>
>I'm using 7.3.2
>
>TIA
>
>
For this case of problem, I find it great to generate scripts out of the
catalog(here for the current schema):

SELECT 'GRANT <WHATEVER> ON '||tablename||' TO <WHOEVER>;'
FROM pg_tables
WHERE
schemaname = current_schema();

This way, you can speed up such Problems a lot, and you are still flexible.
Sure, you can put this into a function as well, and run the SQL dynamically.
(But I rather have allok at the generated statements before I run them.

Cheers,
Dani

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Smitha V. Babu 2003-06-18 08:58:25 help:steps needed to get the content of table from the database.. .
Previous Message Bruno Wolff III 2003-06-18 03:27:01 Re: grant select on all tables of a schema