1DROP ROLE(7)             PostgreSQL 14.3 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 and DROP OWNED commands can be useful for this purpose;
21       see Section 22.4 for more discussion.
22
23       However, it is not necessary to remove role memberships involving the
24       role; DROP ROLE automatically revokes any memberships of the target
25       role in other roles, and of other roles in the target role. The other
26       roles are not dropped nor otherwise affected.
27

PARAMETERS

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

NOTES

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

EXAMPLES

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

COMPATIBILITY

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

SEE ALSO

52       CREATE ROLE (CREATE_ROLE(7)), ALTER ROLE (ALTER_ROLE(7)), SET ROLE
53       (SET_ROLE(7))
54
55
56
57PostgreSQL 14.3                      2022                         DROP ROLE(7)
Impressum