0

I'm trying to drop a role but getting this: ERROR: role "xyz" cannot be dropped because some objects depend on it It shows which objects are, they are tables on different schemas on different DBs on the server. Is there an easy way to remove the role without having to revoke privileges one by one on all tables/schemas on all databases?

I don't want to drop owned by as I read somewhere, just drop the role

Thanks!

Matias
  • 539
  • 5
  • 28
  • See here [Drop role](https://www.postgresql.org/docs/current/role-removal.html) – Adrian Klaver Feb 25 '21 at 11:13
  • This helps, however, I'm looking for a way to remove all role assigned grants at once, not going one by one on each table/schema. Does "reassign owned" removes the assignments from the role you're trying to delete? – Matias Feb 25 '21 at 11:21

1 Answers1

3

There is no easy way.

Some commands save you work: REASSIGN OWNED, REVOKE ALL ON ALL ... IN SCHEMA .... But eventually, you will have to remove all these dependencies before you can drop the role.

Don't forget that single a role can own objects / have permissions in many databases.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263