DROP ROLE removes the specified role(s).
drop_role ::= DROP ROLE [ IF EXISTS ] role_name [ , ... ]
role_nameis the name of the role to be removed.
To drop a superuser role, you must be a superuser yourself. To drop non-superuser roles, you must have CREATEROLE privilege.
Before dropping the role, you must drop all the objects it owns (or reassign their ownership) and revoke any privileges the role has been granted on other objects. The
REASSIGN OWNED and
DROP OWNED commands can be used for this purpose.
It is, however, not necessary to remove role memberships involving the role.
DROP ROLE automatically revokes any memberships of the target role in other roles, and of other roles in the target role. The other roles are not dropped or affected.
- Drop a role.
yugabyte=# DROP ROLE John;