Categories:

User & Security DDL (Roles)

DROP ROLE

Removes the specified role from the system.

Syntax

DROP ROLE [ IF EXISTS ] <name>

Parameters

name

Specifies the identifier for the role to drop. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

Usage Notes

  • Dropped roles cannot be recovered; they must be recreated.

  • Ownership of any objects owned by the dropped role is transferred to the role that executes the DROP ROLE command. To transfer ownership of each of these objects to a different role, use GRANT OWNERSHIP … COPY CURRENT GRANTS.

  • If a role has a future privilege as a grantor or grantee, the role can only be dropped by a user with a role that has the MANAGE GRANTS privilege.

  • All current and future grants that name the role as either the grantor or the grantee are removed when the role is dropped.

  • If a role is a grantor of roles to users, dropping the role revokes these grants automatically.

Examples

DROP ROLE myrole;