1DROP ROLE(7)             PostgreSQL 13.4 Documentation            DROP ROLE(7)
2
3
4

NAME

6       DROP_ROLE - remove a database role
7

SYNOPSIS

9       DROP ROLE [ IF EXISTS ] name [, ...]
10

DESCRIPTION

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

PARAMETERS

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

NOTES

38       PostgreSQL includes a program 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

COMPATIBILITY

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

SEE ALSO

53       CREATE ROLE (CREATE_ROLE(7)), ALTER ROLE (ALTER_ROLE(7)), SET ROLE
54       (SET_ROLE(7))
55
56
57
58PostgreSQL 13.4                      2021                         DROP ROLE(7)
Impressum