Обсуждение: Read Access to database

Поиск
Список
Период
Сортировка

Read Access to database

От
"Ashish Karalkar"
Дата:
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.
 
Thanks in advance
 
With regards
Ashish...
 
 

Re: Read Access to database

От
"A. Kretschmer"
Дата:
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
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: Read Access to database

От
Kevin Neufeld
Дата:
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
>