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