]> begriffs open source - ai-pg/blob - full-docs/txt/sql-droprole.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-droprole.txt
1
2 DROP ROLE
3
4    DROP ROLE — remove a database role
5
6 Synopsis
7
8 DROP ROLE [ IF EXISTS ] name [, ...]
9
10 Description
11
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 21.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
29 Parameters
30
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
36           The name of the role to remove.
37
38 Notes
39
40    PostgreSQL includes a program dropuser that has the same functionality
41    as this command (in fact, it calls this command) but can be run from
42    the command shell.
43
44 Examples
45
46    To drop a role:
47 DROP ROLE jonathan;
48
49 Compatibility
50
51    The SQL standard defines DROP ROLE, but it allows only one role to be
52    dropped at a time, and it specifies different privilege requirements
53    than PostgreSQL uses.
54
55 See Also
56
57    CREATE ROLE, ALTER ROLE, SET ROLE