]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/alter_group.sgml
Trim trailing whitespace
[postgresql] / doc / src / sgml / ref / alter_group.sgml
1 <!--
2 doc/src/sgml/ref/alter_group.sgml
3 PostgreSQL documentation
4 -->
5
6 <refentry id="SQL-ALTERGROUP">
7  <indexterm zone="sql-altergroup">
8   <primary>ALTER GROUP</primary>
9  </indexterm>
10
11  <refmeta>
12   <refentrytitle>ALTER GROUP</refentrytitle>
13   <manvolnum>7</manvolnum>
14   <refmiscinfo>SQL - Language Statements</refmiscinfo>
15  </refmeta>
16
17  <refnamediv>
18   <refname>ALTER GROUP</refname>
19   <refpurpose>change role name or membership</refpurpose>
20  </refnamediv>
21
22  <refsynopsisdiv>
23 <synopsis>
24 ALTER GROUP <replaceable class="PARAMETER">role_specification</replaceable> ADD USER <replaceable class="PARAMETER">user_name</replaceable> [, ... ]
25 ALTER GROUP <replaceable class="PARAMETER">role_specification</replaceable> DROP USER <replaceable class="PARAMETER">user_name</replaceable> [, ... ]
26
27 <phrase>where <replaceable class="PARAMETER">role_specification</replaceable> can be:</phrase>
28
29     <replaceable class="PARAMETER">role_name</replaceable>
30   | CURRENT_USER
31   | SESSION_USER
32
33 ALTER GROUP <replaceable class="PARAMETER">group_name</replaceable> RENAME TO <replaceable>new_name</replaceable>
34 </synopsis>
35  </refsynopsisdiv>
36
37  <refsect1>
38   <title>Description</title>
39
40   <para>
41    <command>ALTER GROUP</command> changes the attributes of a user group.
42    This is an obsolete command, though still accepted for backwards
43    compatibility, because groups (and users too) have been superseded by the
44    more general concept of roles.
45   </para>
46
47   <para>
48    The first two variants add users to a group or remove them from a group.
49    (Any role can play the part of either a <quote>user</> or a
50    <quote>group</> for this purpose.)  These variants are effectively
51    equivalent to granting or revoking membership in the role named as the
52    <quote>group</>; so the preferred way to do this is to use
53    <xref linkend="SQL-GRANT"> or
54    <xref linkend="SQL-REVOKE">.
55   </para>
56
57   <para>
58    The third variant changes the name of the group.  This is exactly
59    equivalent to renaming the role with
60    <xref linkend="sql-alterrole">.
61   </para>
62  </refsect1>
63
64  <refsect1>
65   <title>Parameters</title>
66
67   <variablelist>
68    <varlistentry>
69     <term><replaceable class="PARAMETER">group_name</replaceable></term>
70     <listitem>
71      <para>
72       The name of the group (role) to modify.
73      </para>
74     </listitem>
75    </varlistentry>
76
77    <varlistentry>
78     <term><replaceable class="PARAMETER">user_name</replaceable></term>
79     <listitem>
80      <para>
81       Users (roles) that are to be added to or removed from the group.
82       The users must already exist; <command>ALTER GROUP</> does not
83       create or drop users.
84      </para>
85     </listitem>
86    </varlistentry>
87
88    <varlistentry>
89     <term><replaceable>new_name</replaceable></term>
90     <listitem>
91      <para>
92       The new name of the group.
93      </para>
94     </listitem>
95    </varlistentry>
96   </variablelist>
97  </refsect1>
98
99  <refsect1>
100   <title>Examples</title>
101   <para>
102    Add users to a group:
103
104 <programlisting>
105 ALTER GROUP staff ADD USER karl, john;
106 </programlisting>
107
108    Remove a user from a group:
109
110 <programlisting>
111 ALTER GROUP workers DROP USER beth;
112 </programlisting></para>
113  </refsect1>
114
115  <refsect1>
116   <title>Compatibility</title>
117
118   <para>
119    There is no <command>ALTER GROUP</command> statement in the SQL
120    standard.
121   </para>
122  </refsect1>
123
124  <refsect1>
125   <title>See Also</title>
126
127   <simplelist type="inline">
128    <member><xref linkend="sql-grant"></member>
129    <member><xref linkend="sql-revoke"></member>
130    <member><xref linkend="sql-alterrole"></member>
131   </simplelist>
132  </refsect1>
133
134 </refentry>