Search Postgresql Archives

Re: Restoring default privileges on objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On 29/08/2023 03:23 CEST Stuart McGraw <smcgraw@xxxxxxxxxx> wrote:
>
> If I've done a GRANT or REVOKE on some of the tables, how do I restore
> the default privileges so that the “Access privileges” appears empty
> again?  I re-granted what I think are the default privileges but the
> "Access privileges" column for that table contains "user1=arwdDxt/user1"
> rather than being blank.  This is Postgresql-14.

Yes, "user1=arwdDxt/user1" matches the default privileges if user1 is the table
owner.  Function acldefault('r', 'user1'::regrole) [1] gives you the default
privileges for tables.

You could set pg_class.relacl to NULL to restore the default privileges, but
messing with pg_catalog is at your own risk.  Besides that I don't know of any
way to restore the default privileges other than revoking all privileges before
granting whatever acldefault gives you.  Changing the table owner will then
also change the grantee and grantor in pg_class.relacl to the new owner.

[1] https://www.postgresql.org/docs/14/functions-info.html#FUNCTIONS-ACLITEM-FN-TABLE

--
Erik






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux