Thread: how to setup default privileges

how to setup default privileges

From
Emi Lu
Date:
Hello,

When an object is created by the default user "user1", I ran:
\dp+ tableName , and got:


   Schema    | Name | Type  | Access privileges
-------------+------+-------+-------------------
 schemaName | t1   | table |                       --- step 0

The Access privileges is blank. However, I am able to insert, update,
delete , etc on the newly created t1.

Could somebody tell me that what are the default privileges for table t1
please? Does it equal to
grant all on t1 to "user1", please?


After running "revoke all on t1 from user1", how to reset the table
privileges back to step 0 please?


Thanks a lot,
Emi





Re: how to setup default privileges

From
Tom Lane
Date:
Emi Lu <emilu@encs.concordia.ca> writes:
> Could somebody tell me that what are the default privileges for table t1
> please? Does it equal to
> grant all on t1 to "user1", please?

Yes.  See the reference page for GRANT for details.

            regards, tom lane

Re: how to setup default privileges

From
Emi Lu
Date:
When I first created an object, and did "\dp+ tableName"

I got blank under "Access privileges". However, if I tried to grant any
permission to a group/user, I will see the access privileges for the
object owner.

Example:

1. create table test(id char(3));
2. \dp+ test;

   Schema    | Name | Type  | Access privileges
-------------+------+-------+-------------------
 abc | test | table |

3. grant select on test to group g1;

4. \dp+ test

5. After grant to g1, we see the default privileges for objectOwner now:

   Schema    | Name | Type  |                           Access privileges
-------------+------+-------+-----------------------------------------------------------------------
 abc | test | table | {objectOwner=arwdRxt/abc,"group g1=r/abc"}






>>Could somebody tell me that what are the default privileges for table t1
>>please? Does it equal to
>>grant all on t1 to "user1", please?
>>
>>
>
>Yes.  See the reference page for GRANT for details.
>
>            regards, tom lane
>
>