2008-12-19 17:25:19 +01:00
|
|
|
<!--
|
2010-09-20 22:08:53 +02:00
|
|
|
doc/src/sgml/ref/alter_user_mapping.sgml
|
2008-12-19 17:25:19 +01:00
|
|
|
PostgreSQL documentation
|
|
|
|
-->
|
|
|
|
|
2017-10-20 03:16:39 +02:00
|
|
|
<refentry id="sql-alterusermapping">
|
2014-02-24 03:25:35 +01:00
|
|
|
<indexterm zone="sql-alterusermapping">
|
|
|
|
<primary>ALTER USER MAPPING</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
2008-12-19 17:25:19 +01:00
|
|
|
<refmeta>
|
2010-04-03 09:23:02 +02:00
|
|
|
<refentrytitle>ALTER USER MAPPING</refentrytitle>
|
2009-06-19 17:28:25 +02:00
|
|
|
<manvolnum>7</manvolnum>
|
2008-12-19 17:25:19 +01:00
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
<refname>ALTER USER MAPPING</refname>
|
|
|
|
<refpurpose>change the definition of a user mapping</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<synopsis>
|
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
|
|
|
ALTER USER MAPPING FOR { <replaceable class="parameter">user_name</replaceable> | USER | CURRENT_USER | SESSION_USER | PUBLIC }
|
2009-09-19 12:23:27 +02:00
|
|
|
SERVER <replaceable class="parameter">server_name</replaceable>
|
2017-10-09 04:00:57 +02:00
|
|
|
OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ] )
|
2008-12-19 17:25:19 +01:00
|
|
|
</synopsis>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<command>ALTER USER MAPPING</command> changes the definition of a
|
2009-01-20 10:10:20 +01:00
|
|
|
user mapping.
|
2008-12-19 17:25:19 +01:00
|
|
|
</para>
|
|
|
|
|
2009-01-20 10:10:20 +01:00
|
|
|
<para>
|
|
|
|
The owner of a foreign server can alter user mappings for that
|
|
|
|
server for any user. Also, a user can alter a user mapping for
|
2017-10-09 03:44:17 +02:00
|
|
|
their own user name if <literal>USAGE</literal> privilege on the server has
|
2009-01-20 10:10:20 +01:00
|
|
|
been granted to the user.
|
|
|
|
</para>
|
2008-12-19 17:25:19 +01:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Parameters</title>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2009-09-19 12:23:27 +02:00
|
|
|
<term><replaceable class="parameter">user_name</replaceable></term>
|
2008-12-19 17:25:19 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2017-10-09 03:44:17 +02:00
|
|
|
User name of the mapping. <literal>CURRENT_USER</literal>
|
|
|
|
and <literal>USER</literal> match the name of the current
|
|
|
|
user. <literal>PUBLIC</literal> is used to match all present and future
|
2008-12-19 17:25:19 +01:00
|
|
|
user names in the system.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2009-09-19 12:23:27 +02:00
|
|
|
<term><replaceable class="parameter">server_name</replaceable></term>
|
2008-12-19 17:25:19 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Server name of the user mapping.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 04:00:57 +02:00
|
|
|
<term><literal>OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ] )</literal></term>
|
2008-12-19 17:25:19 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Change options for the user mapping. The new options override
|
|
|
|
any previously specified
|
2017-10-09 03:44:17 +02:00
|
|
|
options. <literal>ADD</literal>, <literal>SET</literal>, and <literal>DROP</literal>
|
|
|
|
specify the action to be performed. <literal>ADD</literal> is assumed
|
2008-12-19 17:25:19 +01:00
|
|
|
if no operation is explicitly specified. Option names must be
|
|
|
|
unique; options are also validated by the server's foreign-data
|
|
|
|
wrapper.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Examples</title>
|
|
|
|
|
|
|
|
<para>
|
2017-10-09 03:44:17 +02:00
|
|
|
Change the password for user mapping <literal>bob</literal>, server <literal>foo</literal>:
|
2008-12-19 17:25:19 +01:00
|
|
|
<programlisting>
|
2016-09-20 18:00:00 +02:00
|
|
|
ALTER USER MAPPING FOR bob SERVER foo OPTIONS (SET password 'public');
|
2011-08-07 09:49:45 +02:00
|
|
|
</programlisting></para>
|
2008-12-19 17:25:19 +01:00
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Compatibility</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<command>ALTER USER MAPPING</command> conforms to ISO/IEC 9075-9
|
|
|
|
(SQL/MED). There is a subtle syntax issue: The standard omits
|
|
|
|
the <literal>FOR</literal> key word. Since both <literal>CREATE
|
|
|
|
USER MAPPING</literal> and <literal>DROP USER MAPPING</literal> use
|
|
|
|
<literal>FOR</literal> in analogous positions, and IBM DB2 (being
|
|
|
|
the other major SQL/MED implementation) also requires it
|
|
|
|
for <literal>ALTER USER MAPPING</literal>, PostgreSQL diverges from
|
|
|
|
the standard here in the interest of consistency and
|
|
|
|
interoperability.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
2017-11-23 15:39:47 +01:00
|
|
|
<member><xref linkend="sql-createusermapping"/></member>
|
|
|
|
<member><xref linkend="sql-dropusermapping"/></member>
|
2008-12-19 17:25:19 +01:00
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
</refentry>
|