2000-01-14 23:11:38 +01:00
|
|
|
<!--
|
2010-09-20 22:08:53 +02:00
|
|
|
doc/src/sgml/ref/alter_group.sgml
|
2001-12-08 04:24:40 +01:00
|
|
|
PostgreSQL documentation
|
2000-01-14 23:11:38 +01:00
|
|
|
-->
|
|
|
|
|
2017-10-20 03:16:39 +02:00
|
|
|
<refentry id="sql-altergroup">
|
2014-02-24 03:25:35 +01:00
|
|
|
<indexterm zone="sql-altergroup">
|
|
|
|
<primary>ALTER GROUP</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
2000-01-14 23:11:38 +01:00
|
|
|
<refmeta>
|
2010-04-03 09:23:02 +02:00
|
|
|
<refentrytitle>ALTER GROUP</refentrytitle>
|
2008-11-14 11:22:48 +01:00
|
|
|
<manvolnum>7</manvolnum>
|
2000-01-14 23:11:38 +01:00
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
2003-04-15 15:25:08 +02:00
|
|
|
|
2000-01-14 23:11:38 +01:00
|
|
|
<refnamediv>
|
2003-04-15 15:25:08 +02:00
|
|
|
<refname>ALTER GROUP</refname>
|
2005-07-27 01:24:02 +02:00
|
|
|
<refpurpose>change role name or membership</refpurpose>
|
2000-01-14 23:11:38 +01:00
|
|
|
</refnamediv>
|
2003-04-15 15:25:08 +02:00
|
|
|
|
2000-01-14 23:11:38 +01:00
|
|
|
<refsynopsisdiv>
|
2003-04-15 15:25:08 +02:00
|
|
|
<synopsis>
|
2017-10-09 04:00:57 +02:00
|
|
|
ALTER GROUP <replaceable class="parameter">role_specification</replaceable> ADD USER <replaceable class="parameter">user_name</replaceable> [, ... ]
|
|
|
|
ALTER GROUP <replaceable class="parameter">role_specification</replaceable> DROP USER <replaceable class="parameter">user_name</replaceable> [, ... ]
|
Allow CURRENT/SESSION_USER to be used in certain commands
Commands such as ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and the
various ALTER OBJECT / OWNER TO, as well as ad-hoc clauses related to
roles such as the AUTHORIZATION clause of CREATE SCHEMA, the FOR clause
of CREATE USER MAPPING, and the FOR ROLE clause of ALTER DEFAULT
PRIVILEGES can now take the keywords CURRENT_USER and SESSION_USER as
user specifiers in place of an explicit user name.
This commit also fixes some quite ugly handling of special standards-
mandated syntax in CREATE USER MAPPING, which in particular would fail
to work in presence of a role named "current_user".
The special role specifiers PUBLIC and NONE also have more consistent
handling now.
Also take the opportunity to add location tracking to user specifiers.
Authors: Kyotaro Horiguchi. Heavily reworked by Álvaro Herrera.
Reviewed by: Rushabh Lathia, Adam Brightwell, Marti Raudsepp.
2015-03-09 19:41:54 +01:00
|
|
|
|
2017-10-09 04:00:57 +02:00
|
|
|
<phrase>where <replaceable class="parameter">role_specification</replaceable> can be:</phrase>
|
Allow CURRENT/SESSION_USER to be used in certain commands
Commands such as ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and the
various ALTER OBJECT / OWNER TO, as well as ad-hoc clauses related to
roles such as the AUTHORIZATION clause of CREATE SCHEMA, the FOR clause
of CREATE USER MAPPING, and the FOR ROLE clause of ALTER DEFAULT
PRIVILEGES can now take the keywords CURRENT_USER and SESSION_USER as
user specifiers in place of an explicit user name.
This commit also fixes some quite ugly handling of special standards-
mandated syntax in CREATE USER MAPPING, which in particular would fail
to work in presence of a role named "current_user".
The special role specifiers PUBLIC and NONE also have more consistent
handling now.
Also take the opportunity to add location tracking to user specifiers.
Authors: Kyotaro Horiguchi. Heavily reworked by Álvaro Herrera.
Reviewed by: Rushabh Lathia, Adam Brightwell, Marti Raudsepp.
2015-03-09 19:41:54 +01:00
|
|
|
|
2017-10-09 04:00:57 +02:00
|
|
|
<replaceable class="parameter">role_name</replaceable>
|
2020-09-17 11:39:28 +02:00
|
|
|
| CURRENT_ROLE
|
Allow CURRENT/SESSION_USER to be used in certain commands
Commands such as ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and the
various ALTER OBJECT / OWNER TO, as well as ad-hoc clauses related to
roles such as the AUTHORIZATION clause of CREATE SCHEMA, the FOR clause
of CREATE USER MAPPING, and the FOR ROLE clause of ALTER DEFAULT
PRIVILEGES can now take the keywords CURRENT_USER and SESSION_USER as
user specifiers in place of an explicit user name.
This commit also fixes some quite ugly handling of special standards-
mandated syntax in CREATE USER MAPPING, which in particular would fail
to work in presence of a role named "current_user".
The special role specifiers PUBLIC and NONE also have more consistent
handling now.
Also take the opportunity to add location tracking to user specifiers.
Authors: Kyotaro Horiguchi. Heavily reworked by Álvaro Herrera.
Reviewed by: Rushabh Lathia, Adam Brightwell, Marti Raudsepp.
2015-03-09 19:41:54 +01:00
|
|
|
| CURRENT_USER
|
|
|
|
| SESSION_USER
|
2003-06-27 16:45:32 +02:00
|
|
|
|
2017-10-09 04:00:57 +02:00
|
|
|
ALTER GROUP <replaceable class="parameter">group_name</replaceable> RENAME TO <replaceable>new_name</replaceable>
|
2003-04-15 15:25:08 +02:00
|
|
|
</synopsis>
|
2000-01-14 23:11:38 +01:00
|
|
|
</refsynopsisdiv>
|
|
|
|
|
2003-04-15 15:25:08 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
|
2000-01-14 23:11:38 +01:00
|
|
|
<para>
|
2005-01-04 01:39:53 +01:00
|
|
|
<command>ALTER GROUP</command> changes the attributes of a user group.
|
2005-07-27 01:24:02 +02:00
|
|
|
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.
|
2005-01-04 01:39:53 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The first two variants add users to a group or remove them from a group.
|
2017-10-09 03:44:17 +02:00
|
|
|
(Any role can play the part of either a <quote>user</quote> or a
|
|
|
|
<quote>group</quote> for this purpose.) These variants are effectively
|
2005-07-27 01:24:02 +02:00
|
|
|
equivalent to granting or revoking membership in the role named as the
|
2017-10-09 03:44:17 +02:00
|
|
|
<quote>group</quote>; so the preferred way to do this is to use
|
Improve <xref> vs. <command> formatting in the documentation
SQL commands are generally marked up as <command>, except when a link
to a reference page is used using <xref>. But the latter doesn't
create monospace markup, so this looks strange especially when a
paragraph contains a mix of links and non-links.
We considered putting <command> in the <refentrytitle> on the target
side, but that creates some formatting side effects elsewhere.
Generally, it seems safer to solve this on the link source side.
We can't put the <xref> inside the <command>; the DTD doesn't allow
this. DocBook 5 would allow the <command> to have the linkend
attribute itself, but we are not there yet.
So to solve this for now, convert the <xref>s to <link> plus
<command>. This gives the correct look and also gives some more
flexibility what we can put into the link text (e.g., subcommands or
other clauses). In the future, these could then be converted to
DocBook 5 style.
I haven't converted absolutely all xrefs to SQL command reference
pages, only those where we care about the appearance of the link text
or where it was otherwise appropriate to make the appearance match a
bit better. Also in some cases, the links where repetitive, so in
those cases the links where just removed and replaced by a plain
<command>. In cases where we just want the link and don't
specifically care about the generated link text (typically phrased
"for further information see <xref ...>") the xref is kept.
Reported-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://www.postgresql.org/message-id/flat/87o8pco34z.fsf@wibble.ilmari.org
2020-10-03 16:16:51 +02:00
|
|
|
<link linkend="sql-grant"><command>GRANT</command></link> or
|
|
|
|
<link linkend="sql-revoke"><command>REVOKE</command></link>.
|
2000-01-14 23:11:38 +01:00
|
|
|
</para>
|
2003-04-15 15:25:08 +02:00
|
|
|
|
2000-01-14 23:11:38 +01:00
|
|
|
<para>
|
2005-07-27 01:24:02 +02:00
|
|
|
The third variant changes the name of the group. This is exactly
|
2010-11-23 21:27:50 +01:00
|
|
|
equivalent to renaming the role with
|
Improve <xref> vs. <command> formatting in the documentation
SQL commands are generally marked up as <command>, except when a link
to a reference page is used using <xref>. But the latter doesn't
create monospace markup, so this looks strange especially when a
paragraph contains a mix of links and non-links.
We considered putting <command> in the <refentrytitle> on the target
side, but that creates some formatting side effects elsewhere.
Generally, it seems safer to solve this on the link source side.
We can't put the <xref> inside the <command>; the DTD doesn't allow
this. DocBook 5 would allow the <command> to have the linkend
attribute itself, but we are not there yet.
So to solve this for now, convert the <xref>s to <link> plus
<command>. This gives the correct look and also gives some more
flexibility what we can put into the link text (e.g., subcommands or
other clauses). In the future, these could then be converted to
DocBook 5 style.
I haven't converted absolutely all xrefs to SQL command reference
pages, only those where we care about the appearance of the link text
or where it was otherwise appropriate to make the appearance match a
bit better. Also in some cases, the links where repetitive, so in
those cases the links where just removed and replaced by a plain
<command>. In cases where we just want the link and don't
specifically care about the generated link text (typically phrased
"for further information see <xref ...>") the xref is kept.
Reported-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://www.postgresql.org/message-id/flat/87o8pco34z.fsf@wibble.ilmari.org
2020-10-03 16:16:51 +02:00
|
|
|
<link linkend="sql-alterrole"><command>ALTER ROLE</command></link>.
|
2000-01-14 23:11:38 +01:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2003-04-15 15:25:08 +02:00
|
|
|
<refsect1>
|
2003-09-12 02:12:47 +02:00
|
|
|
<title>Parameters</title>
|
2003-04-15 15:25:08 +02:00
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2017-10-09 04:00:57 +02:00
|
|
|
<term><replaceable class="parameter">group_name</replaceable></term>
|
2003-04-15 15:25:08 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-07-27 01:24:02 +02:00
|
|
|
The name of the group (role) to modify.
|
2003-04-15 15:25:08 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 04:00:57 +02:00
|
|
|
<term><replaceable class="parameter">user_name</replaceable></term>
|
2003-04-15 15:25:08 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-07-27 01:24:02 +02:00
|
|
|
Users (roles) that are to be added to or removed from the group.
|
2017-10-09 03:44:17 +02:00
|
|
|
The users must already exist; <command>ALTER GROUP</command> does not
|
2005-07-27 01:24:02 +02:00
|
|
|
create or drop users.
|
2003-04-15 15:25:08 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2003-06-27 16:45:32 +02:00
|
|
|
|
|
|
|
<varlistentry>
|
2009-09-19 12:23:27 +02:00
|
|
|
<term><replaceable>new_name</replaceable></term>
|
2003-06-27 16:45:32 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The new name of the group.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2003-04-15 15:25:08 +02:00
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Examples</title>
|
2000-01-14 23:11:38 +01:00
|
|
|
<para>
|
|
|
|
Add users to a group:
|
|
|
|
|
|
|
|
<programlisting>
|
2001-09-12 03:55:25 +02:00
|
|
|
ALTER GROUP staff ADD USER karl, john;
|
2000-01-14 23:11:38 +01:00
|
|
|
</programlisting>
|
|
|
|
|
2000-07-22 04:39:10 +02:00
|
|
|
Remove a user from a group:
|
2000-01-14 23:11:38 +01:00
|
|
|
|
|
|
|
<programlisting>
|
2001-09-12 03:55:25 +02:00
|
|
|
ALTER GROUP workers DROP USER beth;
|
2011-08-07 09:49:45 +02:00
|
|
|
</programlisting></para>
|
2000-01-14 23:11:38 +01:00
|
|
|
</refsect1>
|
|
|
|
|
2003-04-15 15:25:08 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Compatibility</title>
|
2010-11-23 21:27:50 +01:00
|
|
|
|
2003-04-15 15:25:08 +02:00
|
|
|
<para>
|
|
|
|
There is no <command>ALTER GROUP</command> statement in the SQL
|
2005-07-27 01:24:02 +02:00
|
|
|
standard.
|
2003-04-15 15:25:08 +02:00
|
|
|
</para>
|
2000-01-14 23:11:38 +01:00
|
|
|
</refsect1>
|
2003-06-27 16:45:32 +02:00
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
2017-11-23 15:39:47 +01:00
|
|
|
<member><xref linkend="sql-grant"/></member>
|
|
|
|
<member><xref linkend="sql-revoke"/></member>
|
|
|
|
<member><xref linkend="sql-alterrole"/></member>
|
2003-06-27 16:45:32 +02:00
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
|
|
|
|
2000-01-14 23:11:38 +01:00
|
|
|
</refentry>
|