DROP ROLE
Marked preset roles include the permission by default; a custom role qualifies when it inherits a role that includes it. Creating, configuring, and dropping custom roles share this permission.
Delete a custom role that is no longer needed. Only custom roles can be dropped. See Roles and access control for the model.
Syntax​
DROP ROLE [ IF EXISTS ] <role_name>;
Dropping a role removes it from every user who holds it, along with the grants made to that role. Users keep their other roles.
Parameters​
| Parameter | Description | Required |
|---|---|---|
<role_name> | Name of the custom role to drop. | Yes |
IF EXISTS | Skip the drop without an error if no role with this name exists. | No |
If dropping a role leaves a user with no roles, that user becomes roleless and loses access to all data until someone with permission to assign roles assigns one. MotherDuck warns before completing the operation but does not block it.
Dropping a preset role (Admin, Builder, or Explorer) returns an error. Dropping a role that does not exist returns an error unless you use IF EXISTS. A role with active memberships cannot be dropped, even with IF EXISTS; revoke the memberships first.
Examples​
Drop a custom role​
DROP ROLE finance;