Re: GRANT SELECT

From: Stephen Crawford <src176(at)psu(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: GRANT SELECT
Date: 2012-08-27 17:32:16
Message-ID: 503BAF20.3040208@psu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I see that works for 9, but I'm still in 8.4. But another person just
sent me a bit of code to do it:

do $$
declare tn text;
begin
for tn in select c.oid::regclass::text
from pg_class c join pg_namespace n on n.oid = c.relnamespace
where n.nspname not in ('pg_catalog',
'information_schema') and n.nspname !~ '^pg_toast' and c.relkind in
('r','')
loop
execute format('grant select on %s to your_user', tn);
end loop;
end;
$$ ;

Thanks,
Steve

On 8/27/2012 1:20 PM, ElEucas wrote:
> *GRANT *{ { SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES
> | TRIGGER } [, ...] | ALL [ PRIVILEGES ] } ON { [ TABLE ] table_name
> [, ...] | *ALL TABLES IN SCHEMA schema_name *[, ...] } TO { [ GROUP ]
> role_name | PUBLIC } [, ...] [ WITH GRANT OPTION ] See more on
> PostgreSQL Documentation
> <http://www.postgresql.org/docs/9.1/static/sql-grant.html>
> --
> ElEucas
> México
>
> ------------------------------------------------------------------------
> View this message in context: Re: GRANT SELECT
> <http://postgresql.1045698.n5.nabble.com/GRANT-SELECT-tp5721395p5721400.html>
> Sent from the PostgreSQL - general mailing list archive
> <http://postgresql.1045698.n5.nabble.com/PostgreSQL-general-f1843780.html>
> at Nabble.com.

--
Stephen Crawford
Center for Environmental Informatics
The Pennsylvania State University

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2012-08-27 17:35:55 Re: GRANT SELECT
Previous Message ElEucas 2012-08-27 17:20:22 Re: GRANT SELECT