]> begriffs open source - ai-pg/blob - full-docs/txt/sql-altergroup.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-altergroup.txt
1
2 ALTER GROUP
3
4    ALTER GROUP — change role name or membership
5
6 Synopsis
7
8 ALTER GROUP role_specification ADD USER user_name [, ... ]
9 ALTER GROUP role_specification DROP USER user_name [, ... ]
10
11 where role_specification can be:
12
13     role_name
14   | CURRENT_ROLE
15   | CURRENT_USER
16   | SESSION_USER
17
18 ALTER GROUP group_name RENAME TO new_name
19
20 Description
21
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
39 Parameters
40
41    group_name
42           The name of the group (role) to modify.
43
44    user_name
45           Users (roles) that are to be added to or removed from the group.
46           The users must already exist; ALTER GROUP does not create or
47           drop users.
48
49    new_name
50           The new name of the group.
51
52 Examples
53
54    Add users to a group:
55 ALTER GROUP staff ADD USER karl, john;
56
57    Remove a user from a group:
58 ALTER GROUP workers DROP USER beth;
59
60 Compatibility
61
62    There is no ALTER GROUP statement in the SQL standard.
63
64 See Also
65
66    GRANT, REVOKE, ALTER ROLE