Re: REVOKE ALL ON ALL OBJECTS IN ALL SCHEMAS FROM some_role?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: DINESH NAIR <Dinesh_Nair(at)iitmpravartak(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: REVOKE ALL ON ALL OBJECTS IN ALL SCHEMAS FROM some_role?
Date: 2025-07-08 20:22:41
Message-ID: CAKFQuwYous3xCT-6uBdMj-byXePiwdtxWw_JzBUPgxXG+bZbEQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Tue, Jul 8, 2025 at 12:54 PM DINESH NAIR <Dinesh_Nair(at)iitmpravartak(dot)net>
wrote:

> When we create a role ,it has no inherent dependencies on other database
> objects.
>

That is patently false otherwise it wouldn't be able to, say, perform:
select version(); See the PUBLIC pseudo-role.

> So, when we execute cascade option for role then >> drop role .. Cascade
> then impact will be high
>

Yeah, don't use cascade.

> *It will drop all objects owned by the role:* This is the most
> significant effect. It will drop tables, views, sequences, functions,
> schemas, and any other database objects that the role owns.
>

Which is why you reassign them first. This is the only real harmful action
given the fact that the role is going away. And why one should not use
cascade.

> *Revokes all privileges granted to the role:* Any GRANT statements that
> gave permissions to role_name will be undone.
>

Good...and what "drop owned by" does once you get the truly owned objects
out of the way via reassigned owned.

> *Removes the role from any roles it is a member of.*
>

Good...

> *Removes any roles that are members of role_name from role_name.*
>

This could have knock-on effects so yeah, this needs to be considered and
dealt with.

Also, could you please start doing inline/bottom posting like everyone else
here does?

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message raphi 2025-07-10 21:53:15 Re: pgstat_snap - create adhoc pg_stat_statements snapshots
Previous Message DINESH NAIR 2025-07-08 19:54:16 Re: REVOKE ALL ON ALL OBJECTS IN ALL SCHEMAS FROM some_role?