0

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

Andrus
  • 26,339
  • 60
  • 204
  • 378
  • You need to change the owner of all objects belonging to admin see https://stackoverflow.com/questions/59785733/how-to-alter-the-ownership-of-some-tables-inside-a-database-from-postgres-to-ano and https://stackoverflow.com/questions/23933327/best-way-to-change-the-owner-of-a-postgresql-database-and-their-tables –  Apr 13 '22 at 09:42

1 Answers1

1

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.

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