Question about Privileges

From: Jack W <dbdevelop2000(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Question about Privileges
Date: 2009-03-12 22:32:14
Message-ID: 3473330e0903121532xe75aaa0x3e4ba9abbf8e306d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Assume that I have the following database:

Database: mydb
Schema: mydb_schema
Tables: mydb_table1
mydb_table2
mydb_table3

I create a role: Create Role dbuser LOGIN;

mydb=# grant all privileges on mydb_schema.mydb_table1 to dbuser;
mydb=# grant all privileges on SCHEMA mydb_schema to dbuser;

Remotely connect dbuser to mydb and run SELECT:
mydb=#select * from mydb_schema.mydb_table1;

Here I want to do a SELECT on mydb_table1 as the above line shows. It seems
to me that I have to grant Privileges to dbuser on both the mydb_schema and
mydb_table1 so that the dbuser can run SELECT.
If there are 10 tables under mydb_schema, do I need to grant privileges to
the dbuser on all the 10 tables individully so that dbuser can operate the
10 tables?

I also find that if I only grant privileges on database to dbuser as below,
without granting privileges on Schema and table to dbuser, dbuser still can
not do SELECT on the tables.
mydb=# grant all privileges on Database mydb to dbuser;

Is there any simple way to grant All privileges to dbuser on all the 10
tables?

Thanks.

Jack

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A.M. 2009-03-12 22:39:27 Re: nulls
Previous Message James B. Byrne 2009-03-12 21:50:54 Re: nulls