Read Access to database

Started by Ashish Karalkarover 18 years ago3 messagesgeneral
Jump to latest
#1Ashish Karalkar
ashish.karalkar@info-spectrum.com

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...

#2A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Ashish Karalkar (#1)
Re: Read Access to database

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

#3Kevin Neufeld
kneufeld@refractions.net
In reply to: A. Kretschmer (#2)
Re: Read Access to database

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:

Show quoted text

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