DROP USER statement removes one or more SQL users. You can use the keywords ROLE and USER interchangeably. DROP USER is an alias for DROP ROLE.
The
DROP USER statement performs a schema change. For more information about how online schema changes work in CockroachDB, see Online Schema Changes.Considerations
- The
adminuser/role cannot be dropped, androotmust always be a member ofadmin. - A user/role cannot be dropped if it has privileges. Use
REVOKEto remove privileges. - Users/roles that own objects (such as databases, tables, schemas, and types) cannot be dropped until the ownership is transferred to another user/role.
- If a user/role is logged in while a different session drops that user, CockroachDB checks that the user exists before allowing it to inherit privileges from the
publicrole. In addition, any active web sessions are revoked when a user is dropped. - To bulk-drop auto-provisioned users (for example, dormant users provisioned through LDAP, OIDC, or JWT authentication), use
DROP PROVISIONED ROLESinstead.
Required privileges
Non-admin users cannot drop admin users. To drop non-admin users, the user must be a member of theadmin role or have the CREATEROLE parameter set.
Synopsis
SeeDROP ROLE: Synopsis.

