pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Christophe Pettus <xof@thebuild.com>
To: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: Can't remove default permissions entry
Date: Thu, 28 May 2020 08:47:53 +0200
Message-ID: <0087809ce65d648b1394b1a21b920ac2b4ea7f88.camel@cybertec.at> (raw)
In-Reply-To: <4BCE1557-F145-46C9-9410-C67CA7510105@thebuild.com>
References: <4BCE1557-F145-46C9-9410-C67CA7510105@thebuild.com>

On Wed, 2020-05-27 at 10:06 -0700, Christophe Pettus wrote:
> On RDS (thus, no superuser) we are trying to drop a user.  The only remaining item that the user owns is an "empty" default permissions entry, but we can't seem to get rid of it so that the user can
> be dropped:
> 
> I'm sure I'm missing something obvious!
> 
> Logged in as xyuser:
> 
> db=> \ddp+
>                     Default access privileges
>    Owner    |    Schema     |   Type   |    Access privileges     
> ------------+---------------+----------+--------------------------
>  xyuser     |               | table    | 
> 
> db=> ALTER DEFAULT PRIVILEGES FOR USER xyuser REVOKE ALL ON TABLES FROM xyuser;
> ALTER DEFAULT PRIVILEGES
> db=> \ddp+
>                     Default access privileges
>    Owner    |    Schema     |   Type   |    Access privileges     
> ------------+---------------+----------+--------------------------
>  xyuser     |               | table    | 

That's tricky one.

The answer must be that the empty entry is *not* a NULL (meaning default
privileges), but actually an empty entry, meaning nobody gets any privileges,
including the table owner.

The solution is to restore the default situation:

ALTER DEFAULT PRIVILEGES FOR ROLE xyuser GRANT ALL ON TABLES TO xyuser;

Then the offending entry should be gone.

It's probably too late to fix that, but in my opinion it was a BAD
design decision to use NULL to represent default privileges, at least
on display.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (3+ messages)

Message-ID: <0087809ce65d648b1394b1a21b920ac2b4ea7f88.camel@cybertec.at>
Permalink:  ../0087809ce65d648b1394b1a21b920ac2b4ea7f88.camel@cybertec.at/
Also on:    postgresql.org/message-id/0087809ce65d648b1394b1a21b920ac2b4ea7f88.camel@cybertec.at

 · 

reply

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: laurenz.albe@cybertec.at, xof@thebuild.com
  Subject: Re: Can't remove default permissions entry
  In-Reply-To: <0087809ce65d648b1394b1a21b920ac2b4ea7f88.camel@cybertec.at>
  References: <4BCE1557-F145-46C9-9410-C67CA7510105@thebuild.com> <0087809ce65d648b1394b1a21b920ac2b4ea7f88.camel@cybertec.at>

* 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