Re: Read Access to database

From: Kevin Neufeld <kneufeld(at)refractions(dot)net>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Read Access to database
Date: 2007-08-28 15:30:35
Message-ID: 46D43F9B.6070106@refractions.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)refractions(dot)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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shane Ambler 2007-08-28 15:44:14 Re: One database vs. hundreds?
Previous Message Paul Tilles 2007-08-28 14:59:42 ecpg: dtime_t vs timestamp