1DROP ROLE(7)             PostgreSQL 16.1 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 and have been granted ADMIN OPTION on the
15       role.
16
17       A role cannot be removed if it is still referenced in any database of
18       the cluster; an error will be raised if so. Before dropping the role,
19       you must drop all the objects it owns (or reassign their ownership) and
20       revoke any privileges the role has been granted on other objects. The
21       REASSIGN OWNED and DROP OWNED commands can be useful for this purpose;
22       see Section 22.4 for more 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 16.1                      2023                         DROP ROLE(7)
Impressum