]> begriffs open source - ai-pg/blob - full-docs/man7/ALTER_GROUP.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / ALTER_GROUP.7
1 '\" t
2 .\"     Title: ALTER GROUP
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "ALTER GROUP" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 ALTER_GROUP \- change role name or membership
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 ALTER GROUP \fIrole_specification\fR ADD USER \fIuser_name\fR [, \&.\&.\&. ]
36 ALTER GROUP \fIrole_specification\fR DROP USER \fIuser_name\fR [, \&.\&.\&. ]
37
38 where \fIrole_specification\fR can be:
39
40     \fIrole_name\fR
41   | CURRENT_ROLE
42   | CURRENT_USER
43   | SESSION_USER
44
45 ALTER GROUP \fIgroup_name\fR RENAME TO \fInew_name\fR
46 .fi
47 .SH "DESCRIPTION"
48 .PP
49 \fBALTER GROUP\fR
50 changes the attributes of a user group\&. This is an obsolete command, though still accepted for backwards compatibility, because groups (and users too) have been superseded by the more general concept of roles\&.
51 .PP
52 The first two variants add users to a group or remove them from a group\&. (Any role can play the part of either a
53 \(lquser\(rq
54 or a
55 \(lqgroup\(rq
56 for this purpose\&.) These variants are effectively equivalent to granting or revoking membership in the role named as the
57 \(lqgroup\(rq; so the preferred way to do this is to use
58 \fBGRANT\fR
59 or
60 \fBREVOKE\fR\&. Note that
61 \fBGRANT\fR
62 and
63 \fBREVOKE\fR
64 have additional options which are not available with this command, such as the ability to grant and revoke
65 ADMIN OPTION, and the ability to specify the grantor\&.
66 .PP
67 The third variant changes the name of the group\&. This is exactly equivalent to renaming the role with
68 \fBALTER ROLE\fR\&.
69 .SH "PARAMETERS"
70 .PP
71 \fIgroup_name\fR
72 .RS 4
73 The name of the group (role) to modify\&.
74 .RE
75 .PP
76 \fIuser_name\fR
77 .RS 4
78 Users (roles) that are to be added to or removed from the group\&. The users must already exist;
79 \fBALTER GROUP\fR
80 does not create or drop users\&.
81 .RE
82 .PP
83 \fInew_name\fR
84 .RS 4
85 The new name of the group\&.
86 .RE
87 .SH "EXAMPLES"
88 .PP
89 Add users to a group:
90 .sp
91 .if n \{\
92 .RS 4
93 .\}
94 .nf
95 ALTER GROUP staff ADD USER karl, john;
96 .fi
97 .if n \{\
98 .RE
99 .\}
100 .sp
101 Remove a user from a group:
102 .sp
103 .if n \{\
104 .RS 4
105 .\}
106 .nf
107 ALTER GROUP workers DROP USER beth;
108 .fi
109 .if n \{\
110 .RE
111 .\}
112 .SH "COMPATIBILITY"
113 .PP
114 There is no
115 \fBALTER GROUP\fR
116 statement in the SQL standard\&.
117 .SH "SEE ALSO"
118 \fBGRANT\fR(7), \fBREVOKE\fR(7), ALTER ROLE (\fBALTER_ROLE\fR(7))