1ALTER GROUP(7) PostgreSQL 16.1 Documentation ALTER GROUP(7)
2
3
4
6 ALTER_GROUP - change role name or membership
7
9 ALTER GROUP role_specification ADD USER user_name [, ... ]
10 ALTER GROUP role_specification DROP USER user_name [, ... ]
11
12 where role_specification can be:
13
14 role_name
15 | CURRENT_ROLE
16 | CURRENT_USER
17 | SESSION_USER
18
19 ALTER GROUP group_name RENAME TO new_name
20
22 ALTER GROUP changes the attributes of a user group. This is an obsolete
23 command, though still accepted for backwards compatibility, because
24 groups (and users too) have been superseded by the more general concept
25 of roles.
26
27 The first two variants add users to a group or remove them from a
28 group. (Any role can play the part of either a “user” or a “group” for
29 this purpose.) These variants are effectively equivalent to granting or
30 revoking membership in the role named as the “group”; so the preferred
31 way to do this is to use GRANT or REVOKE. Note that GRANT and REVOKE
32 have additional options which are not available with this command, such
33 as the ability to grant and revoke ADMIN OPTION, and the ability to
34 specify the grantor.
35
36 The third variant changes the name of the group. This is exactly
37 equivalent to renaming the role with ALTER ROLE.
38
40 group_name
41 The name of the group (role) to modify.
42
43 user_name
44 Users (roles) that are to be added to or removed from the group.
45 The users must already exist; ALTER GROUP does not create or drop
46 users.
47
48 new_name
49 The new name of the group.
50
52 Add users to a group:
53
54 ALTER GROUP staff ADD USER karl, john;
55
56 Remove a user from a group:
57
58 ALTER GROUP workers DROP USER beth;
59
61 There is no ALTER GROUP statement in the SQL standard.
62
64 GRANT(7), REVOKE(7), ALTER ROLE (ALTER_ROLE(7))
65
66
67
68PostgreSQL 16.1 2023 ALTER GROUP(7)