Re: Read Access to database - Mailing list pgsql-general

From Kevin Neufeld
Subject Re: Read Access to database
Date
Msg-id 46D43F9B.6070106@refractions.net
Whole thread Raw
In response to Re: Read Access to database  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List pgsql-general
This seems unnecessarily complicated.

Yes, I believe you do have to grant select on every table, but you can
use psql to generate the queries, then execute them.
i.e.

-- show only tuples
/t

-- output to temp script file.
/o script.sql

-- generate your script using pg_tables
SELECT 'GRANT SELECT ON ' || schemaname || '.' || tablename || ' TO d;'
from pg_tables where schemaname = 'abcs';

-- stop writing to script file.
/o

-- run your script
/i script.sql

You can create a cron job that will do these sequence of commands
nightly if you wish.

Hope this helps,
-- Kevin

--
Kevin Neufeld
Software Developer
Refractions Research Inc.
300-1207 Douglas St.
Victoria, B.C., V8W 2E7

Phone: (250) 383-3022
Email: kneufeld@refractions.net


A. Kretschmer wrote:
> am  Tue, dem 28.08.2007, um 10:56:38 +0530 mailte Ashish Karalkar folgendes:
>
>> Hello all,
>>
>> I have a database  abc  with owner c .
>> I want to grant only read access on this DB abc  to user d.
>> More specificaly to a schema abcs in the databse abc.
>> Is ther any way to do so?
>>
>> I have more than 1000 table so dont want to list all the table name in the
>> grant command.
>>
>
> Okay:
>
> http://www.archonet.com/pgdocs/grant-all.html
>
> Andreas
>

pgsql-general by date:

Previous
From: Lincoln Yeoh
Date:
Subject: Re: Tables dissapearing
Next
From: Shane Ambler
Date:
Subject: Re: One database vs. hundreds?