From: Erik Wienhold <ewie@ewie.name>
To: Stuart McGraw <smcgraw@mtneva.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Restoring default privileges on objects
Date: Tue, 29 Aug 2023 13:22:31 +0200 (CEST)
Message-ID: <1166048641.281962.1693308151542@office.mailbox.org> (raw)
In-Reply-To: <96d6885a-5e25-9ae8-4a1a-d7e557a5fe9c@mtneva.com>
References: <96d6885a-5e25-9ae8-4a1a-d7e557a5fe9c@mtneva.com>
> On 29/08/2023 03:23 CEST Stuart McGraw <smcgraw@mtneva.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ewie@ewie.name, smcgraw@mtneva.com
Subject: Re: Restoring default privileges on objects
In-Reply-To: <1166048641.281962.1693308151542@office.mailbox.org>
References: <96d6885a-5e25-9ae8-4a1a-d7e557a5fe9c@mtneva.com> <1166048641.281962.1693308151542@office.mailbox.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox