DROP ROLE

Purpose

Use this statement to delete a role.

Prerequisite

You need to have either the system privilege DROP ANY ROLE or a role with the WITH ADMIN OPTION is assigned to the user.

Syntax

drop_role::=

Drop Role

Usage Notes

  • If CASCADE option is specified, all of the schemas of the role as well as their contents will be deleted.
  • If schemas that belong to the role still exist, CASCADE must be specified or these must be explicitly deleted beforehand by using DROP SCHEMA.
  • This statement will also remove the role from other users who are associated to it. However, open transactions of such users are not affected.
  • If the optional IF EXISTS clause is specified, then the statement does not throw an exception if the role does not exist.
  • If you have created a role, it does not meant that you can delete it.

Example

DROP ROLE test_role;