Re: Which commands are guaranteed to drop role

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Andrus <kobruleht2(at)hot(dot)ee>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Which commands are guaranteed to drop role
Date: 2020-04-12 20:09:29
Message-ID: c2bf16aa98b94a87208577ada15ab222aff6c3d3.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 2020-04-12 at 00:25 +0300, Andrus wrote:
> User "currentuser" tries to delete role "roletodelete" from this database using
>
> But got error
>
> ERROR: role "roletodelete" cannot be dropped because some objects depend on it
> DETAIL: privileges for schema public;
>
> How to create script which is guaranteed to delete role ?

You cannot write such a script, but you will have to REVOKE and change ownership
and ALTER DEFAULT PRIVILEGES until no more dependencies on the role exist.

That is why you are well advised not to grant permissions to a role that you
plan to drop.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2020-04-12 22:30:08 Re: Using of --data-checksums
Previous Message Tom Lane 2020-04-12 14:23:24 Re: Using of --data-checksums