Home > Enterprise >  How to drop role from database
How to drop role from database

Time:04-13

I tried to drop role admin using

reassign owned by admin to aus_owner;
ALTER DEFAULT PRIVILEGES FOR ROLE admin  IN SCHEMA public,firma1
   REVOKE ALL ON TABLES FROM admin;
drop role admin

but got error

 ERROR:  role "admin" cannot be dropped because some objects depend on
 it 
DETAIL:  privileges for schema public privileges for database aus

 privileges for schema firma1 privileges for table firma1.summav

 privileges for sequence firma1.summav_recnr_seq ... 
and 2406 other
 objects (see server log for list)

Using PostgreSQL 12.2

CodePudding user response:

After you ran REASSIGN ALL, it is probably enough to run

DROP OWNED BY admin;

to get rid of the privileges granted to the role. Then you should be able to drop it.

Read this for more background information.

  • Related