2008-12-19 17:25:19 +01:00
<!--
2010-09-20 22:08:53 +02:00
doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
2008-12-19 17:25:19 +01:00
PostgreSQL documentation
-->
<refentry id="SQL-ALTERFOREIGNDATAWRAPPER">
2014-02-24 03:25:35 +01:00
<indexterm zone="sql-alterforeigndatawrapper">
<primary>ALTER FOREIGN DATA WRAPPER</primary>
</indexterm>
2008-12-19 17:25:19 +01:00
<refmeta>
2010-04-03 09:23:02 +02:00
<refentrytitle>ALTER FOREIGN DATA WRAPPER</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 FOREIGN DATA WRAPPER</refname>
<refpurpose>change the definition of a foreign-data wrapper</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable>
2011-02-19 06:06:18 +01:00
[ HANDLER <replaceable class="parameter">handler_function</replaceable> | NO HANDLER ]
[ VALIDATOR <replaceable class="parameter">validator_function</replaceable> | NO VALIDATOR ]
2008-12-19 17:25:19 +01:00
[ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</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
ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER }
2011-12-09 19:42:30 +01:00
ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
2008-12-19 17:25:19 +01:00
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>ALTER FOREIGN DATA WRAPPER</command> changes the
definition of a foreign-data wrapper. The first form of the
2011-02-19 06:06:18 +01:00
command changes the support functions or the generic options of the
2008-12-19 17:25:19 +01:00
foreign-data wrapper (at least one clause is required). The second
form changes the owner of the foreign-data wrapper.
</para>
<para>
Only superusers can alter foreign-data wrappers. Additionally,
only superusers can own foreign-data wrappers.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
The name of an existing foreign-data wrapper.
</para>
</listitem>
</varlistentry>
<varlistentry>
2011-02-19 06:06:18 +01:00
<term><literal>HANDLER <replaceable class="parameter">handler_function</replaceable></literal></term>
2008-12-19 17:25:19 +01:00
<listitem>
<para>
2011-02-19 06:06:18 +01:00
Specifies a new handler function for the foreign-data wrapper.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>NO HANDLER</literal></term>
<listitem>
<para>
This is used to specify that the foreign-data wrapper should no
longer have a handler function.
</para>
<para>
Note that foreign tables that use a foreign-data wrapper with no
handler cannot be accessed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>VALIDATOR <replaceable class="parameter">validator_function</replaceable></literal></term>
<listitem>
<para>
Specifies a new validator function for the foreign-data wrapper.
2008-12-19 17:25:19 +01:00
</para>
<para>
2013-10-28 15:28:35 +01:00
Note that it is possible that pre-existing options of the foreign-data
wrapper, or of dependent servers, user mappings, or foreign tables, are
invalid according to the new validator. <productname>PostgreSQL</> does
not check for this. It is up to the user to make sure that these
options are correct before using the modified foreign-data wrapper.
However, any options specified in this <command>ALTER FOREIGN DATA
WRAPPER</> command will be checked using the new validator.
2008-12-19 17:25:19 +01:00
</para>
</listitem>
</varlistentry>
2009-02-24 11:06:36 +01:00
<varlistentry>
<term><literal>NO VALIDATOR</literal></term>
<listitem>
<para>
This is used to specify that the foreign-data wrapper should no
longer have a validator function.
</para>
</listitem>
</varlistentry>
2008-12-19 17:25:19 +01:00
<varlistentry>
<term><literal>OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )</literal></term>
<listitem>
<para>
Change options for the foreign-data
wrapper. <literal>ADD</>, <literal>SET</>, and <literal>DROP</>
specify the action to be performed. <literal>ADD</> is assumed
if no operation is explicitly specified. Option names must be
unique; names and values are also validated using the foreign
2011-02-19 06:06:18 +01:00
data wrapper's validator function, if any.
2008-12-19 17:25:19 +01:00
</para>
</listitem>
</varlistentry>
2011-12-09 19:42:30 +01:00
<varlistentry>
<term><replaceable class="PARAMETER">new_owner</replaceable></term>
<listitem>
<para>
The user name of the new owner of the foreign-data wrapper.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">new_name</replaceable></term>
<listitem>
<para>
The new name for the foreign-data wrapper.
</para>
</listitem>
</varlistentry>
2008-12-19 17:25:19 +01:00
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Change a foreign-data wrapper <literal>dbi</>, add
option <literal>foo</>, drop <literal>bar</>:
<programlisting>
ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP 'bar');
</programlisting>
</para>
<para>
2009-02-24 11:06:36 +01:00
Change the foreign-data wrapper <literal>dbi</> validator
to <literal>bob.myvalidator</>:
2008-12-19 17:25:19 +01:00
<programlisting>
2009-02-24 11:06:36 +01:00
ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;
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 FOREIGN DATA WRAPPER</command> conforms to ISO/IEC
2011-02-19 06:06:18 +01:00
9075-9 (SQL/MED), except that the <literal>HANDLER</literal>,
2011-12-09 19:42:30 +01:00
<literal>VALIDATOR</>, <literal>OWNER TO</>, and <literal>RENAME</literal>
clauses are extensions.
2008-12-19 17:25:19 +01:00
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
2010-04-03 09:23:02 +02:00
<member><xref linkend="sql-createforeigndatawrapper"></member>
<member><xref linkend="sql-dropforeigndatawrapper"></member>
2008-12-19 17:25:19 +01:00
</simplelist>
</refsect1>
</refentry>