DROP ROLE
Removes a role from the database. Only the database superuser can drop a role.
Use the CASCADE option to drop a role that is assigned to one or more users or roles.
Syntax
DROP ROLE role [CASCADE];
Parameters
role |
The name of the role to drop |
CASCADE |
Revoke the role from users and other roles before dropping the role |
Privileges
Must be a superuser to drop a role.
Examples
=> DROP ROLE appadmin; NOTICE: User bob depends on Role appadmin ROLLBACK: DROP ROLE failed due to dependencies DETAIL: Cannot drop Role appadmin because other objects depend on it HINT: Use DROP ROLE ... CASCADE to remove granted roles from the dependent users/roles => DROP ROLE appadmin CASCADE; DROP ROLE