DROP ROLE
DROP ROLE — Remove a database role
Synopsis
DROP ROLE [ IF EXISTS ] name [, ...]
Description
DROP ROLE removes the specified role. To drop a superuser role, you must be a superuser yourself. To drop a non-superuser role, you must have the CREATEROLE privilege.
A role cannot be removed if it is still referenced in any database within the cluster. An error will be raised if you attempt to do so. Before dropping the role, you must drop (or reassign ownership of) all objects it owns and revoke any privileges granted to the role on other objects. The REASSIGN OWNED and DROP OWNED commands can be used for this purpose.
However, it is not necessary to remove role memberships involving the role. DROP ROLE automatically revokes the target role's memberships in other roles, as well as other roles' memberships in the target role. Other roles are not dropped or otherwise affected.
Parameters
IF EXISTS
Do not throw an error if the role does not exist. A notice is issued in this case.
name
The name of the role to remove.
Notes
Halo includes the program dropuser that has the same functionality as this command (in fact, it invokes this command), but the program can be run from the shell.
Examples
# Drop a role:
DROP ROLE jonathan;