DROP ROLE

This page documents the preview version (v2.21). Preview includes features under active development and is for development and testing only. For production, use the stable version (v2024.1). To learn more, see Versioning.

Synopsis

Use the DROP ROLE statement to delete an existing role.

This statement is enabled by setting the YB-TServer flag use_cassandra_authentication to true.

Syntax

Diagram

drop_role

DROPROLEIFEXISTSrole_name

Grammar

drop_role ::=  DROP ROLE [ IF EXISTS ] role_name

Where

  • role_name is a text identifier.

Semantics

  • An error is raised if role_name does not exist unless IF EXISTS option is present.
  • Only a role with the SUPERUSER status can delete another SUPERUSER role.
  • Only a client with the permission DROP on ALL ROLES or on the specified role_name, or with the SUPERUSER status can delete another role.

Examples

ycqlsh:example> DROP ROLE role1;
ycqlsh:example> DROP ROLE IF EXISTS role2;

See also