Re: schema privileges and drop role

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Matt Zagrabelny <mzagrabe(at)d(dot)umn(dot)edu>, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: schema privileges and drop role
Date: 2024-06-25 00:03:32
Message-ID: c09df100-6d68-4a86-901f-e1c11a27da27@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 6/24/24 17:00, Matt Zagrabelny wrote:
> Greetings,
>
> I have a database that I recently changed the ownership for and now I am
> attempting to drop the previous owner of the database:
>
> test_db=# drop ROLE legacy_owner;
> ERROR:  role "legacy_owner" cannot be dropped because some objects
> depend on it
> DETAIL:  privileges for schema public
>
> I don't know where to look to find out what I need to alter to be able
> to remove the legacy role and internet searches came up fruitless.

Generally best to start with the docs:

https://www.postgresql.org/docs/current/sql-droprole.html

"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."

>
> Does anyone have any hints or advice on where to look?
>
> Thanks for the help!
>
> -m

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2024-06-25 00:37:50 Re: Issue with pgstattuple on Sequences in PostgreSQL
Previous Message Matt Zagrabelny 2024-06-25 00:00:23 schema privileges and drop role