如何从数据库中删除角色



我试图使用删除角色管理员

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

但得到错误

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)

使用PostgreSQL 12.2

运行REASSIGN ALL后,运行可能就足够了

DROP OWNED BY admin;

以取消授予该角色的权限。然后你应该可以放下它。

阅读本文了解更多背景信息。

最新更新