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