1DROP ROLE(7)                     SQL Commands                     DROP ROLE(7)
2
3
4

NAME

6       DROP ROLE - remove a database role
7
8

SYNOPSIS

10       DROP ROLE [ IF EXISTS ] name [, ...]
11
12

DESCRIPTION

14       DROP ROLE removes the specified role(s).  To drop a superuser role, you
15       must be a superuser yourself; to drop  non-superuser  roles,  you  must
16       have CREATEROLE privilege.
17
18       A  role  cannot be removed if it is still referenced in any database of
19       the cluster; an error will be raised if so. Before dropping  the  role,
20       you must drop all the objects it owns (or reassign their ownership) and
21       revoke any privileges the role has been  granted.  The  REASSIGN  OWNED
22       [reassign_owned(7)] and DROP OWNED [drop_owned(7)] commands can be use‐
23       ful for this purpose.
24
25       However, it is not necessary to remove role memberships  involving  the
26       role;  DROP  ROLE  automatically  revokes any memberships of the target
27       role in other roles, and of other roles in the target role.  The  other
28       roles are not dropped nor otherwise affected.
29

PARAMETERS

31       IF EXISTS
32              Do  not  throw  an error if the role does not exist. A notice is
33              issued in this case.
34
35       name   The name of the role to remove.
36

NOTES

38       PostgreSQL includes a program dropuser [dropuser(1)] that has the  same
39       functionality  as this command (in fact, it calls this command) but can
40       be run from the command shell.
41

EXAMPLES

43       To drop a role:
44
45       DROP ROLE jonathan;
46
47

COMPATIBILITY

49       The SQL standard defines DROP ROLE, but it allows only one role  to  be
50       dropped  at  a  time, and it specifies different privilege requirements
51       than PostgreSQL uses.
52

SEE ALSO

54       CREATE ROLE [create_role(7)],  ALTER  ROLE  [alter_role(7)],  SET  ROLE
55       [set_role(7)]
56
57
58
59SQL - Language Statements         2011-09-22                      DROP ROLE(7)
Impressum