public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Matt Zagrabelny <[email protected]>
Cc: Adrian Klaver <[email protected]>
Cc: [email protected] >> PG-General Mailing List <[email protected]>
Subject: Re: schema privileges and drop role
Date: Mon, 24 Jun 2024 21:08:59 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOLfK3U-Hweja1P4OKjHe-E_nVmHR5uw7LjovFJJ=yech=hM8Q@mail.gmail.com>
References: <CAOLfK3Wx2VMhNONFpNpnA0LCMXpQgmSadGicJ3K+LF+ayeTWxQ@mail.gmail.com>
	<[email protected]>
	<CAOLfK3U-Hweja1P4OKjHe-E_nVmHR5uw7LjovFJJ=yech=hM8Q@mail.gmail.com>

Matt Zagrabelny <[email protected]> writes:
> On Mon, Jun 24, 2024 at 7:03 PM Adrian Klaver <[email protected]>
> wrote:
>> "A role cannot be removed if it is still referenced in any database of
>> the cluster; an error will be raised if so. Before dropping the role,
>> you must drop all the objects it owns (or reassign their ownership) and
>> revoke any privileges the role has been granted on other objects. The
>> REASSIGN OWNED and DROP OWNED commands can be useful for this purpose;
>> see Section 22.4 for more discussion."

> Cool. I gave it a try, but came up with the same error:

> test_db=# REASSIGN OWNED by legacy_owner TO new_owner;
> REASSIGN OWNED
> Time: 0.212 ms
> test_db=# drop role legacy_owner;
> ERROR:  role "legacy_owner" cannot be dropped because some objects depend
> on it

You need to do DROP OWNED as well to get rid of those privileges.
REASSIGN OWNED only changes the ownership of ownable objects.

> I'd still like to see how to list the "privileges for schema
> public",

"\dn+ public" in psql would do that.

			regards, tom lane






view thread (4+ messages)

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: schema privileges and drop role
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox