]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
Add support for piping COPY to/from an external program.
[postgresql] / doc / src / sgml / ref / alter_foreign_data_wrapper.sgml
1 <!--
2 doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
3 PostgreSQL documentation
4 -->
5
6 <refentry id="SQL-ALTERFOREIGNDATAWRAPPER">
7  <refmeta>
8   <refentrytitle>ALTER FOREIGN DATA WRAPPER</refentrytitle>
9   <manvolnum>7</manvolnum>
10   <refmiscinfo>SQL - Language Statements</refmiscinfo>
11  </refmeta>
12
13  <refnamediv>
14   <refname>ALTER FOREIGN DATA WRAPPER</refname>
15   <refpurpose>change the definition of a foreign-data wrapper</refpurpose>
16  </refnamediv>
17
18  <indexterm zone="sql-alterforeigndatawrapper">
19   <primary>ALTER FOREIGN DATA WRAPPER</primary>
20  </indexterm>
21
22  <refsynopsisdiv>
23 <synopsis>
24 ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable>
25     [ HANDLER <replaceable class="parameter">handler_function</replaceable> | NO HANDLER ]
26     [ VALIDATOR <replaceable class="parameter">validator_function</replaceable> | NO VALIDATOR ]
27     [ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ]) ]
28 ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> OWNER TO <replaceable>new_owner</replaceable>
29 ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
30 </synopsis>
31  </refsynopsisdiv>
32
33  <refsect1>
34   <title>Description</title>
35
36   <para>
37    <command>ALTER FOREIGN DATA WRAPPER</command> changes the
38    definition of a foreign-data wrapper.  The first form of the
39    command changes the support functions or the generic options of the
40    foreign-data wrapper (at least one clause is required).  The second
41    form changes the owner of the foreign-data wrapper.
42   </para>
43
44   <para>
45    Only superusers can alter foreign-data wrappers.  Additionally,
46    only superusers can own foreign-data wrappers.
47   </para>
48  </refsect1>
49
50  <refsect1>
51   <title>Parameters</title>
52
53   <variablelist>
54    <varlistentry>
55     <term><replaceable class="parameter">name</replaceable></term>
56     <listitem>
57      <para>
58       The name of an existing foreign-data wrapper.
59      </para>
60     </listitem>
61    </varlistentry>
62
63    <varlistentry>
64     <term><literal>HANDLER <replaceable class="parameter">handler_function</replaceable></literal></term>
65     <listitem>
66      <para>
67       Specifies a new handler function for the foreign-data wrapper.
68      </para>
69     </listitem>
70    </varlistentry>
71
72    <varlistentry>
73     <term><literal>NO HANDLER</literal></term>
74     <listitem>
75      <para>
76       This is used to specify that the foreign-data wrapper should no
77       longer have a handler function.
78      </para>
79      <para>
80       Note that foreign tables that use a foreign-data wrapper with no
81       handler cannot be accessed.
82      </para>
83     </listitem>
84    </varlistentry>
85
86    <varlistentry>
87     <term><literal>VALIDATOR <replaceable class="parameter">validator_function</replaceable></literal></term>
88     <listitem>
89      <para>
90       Specifies a new validator function for the foreign-data wrapper.
91      </para>
92
93      <para>
94       Note that it is possible that after changing the validator the
95       options to the foreign-data wrapper, servers, and user mappings
96       have become invalid.   It is up to the user to make sure that
97       these options are correct before using the foreign-data
98       wrapper.
99      </para>
100     </listitem>
101    </varlistentry>
102
103    <varlistentry>
104     <term><literal>NO VALIDATOR</literal></term>
105     <listitem>
106      <para>
107       This is used to specify that the foreign-data wrapper should no
108       longer have a validator function.
109      </para>
110     </listitem>
111    </varlistentry>
112
113    <varlistentry>
114     <term><literal>OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )</literal></term>
115     <listitem>
116      <para>
117       Change options for the foreign-data
118       wrapper.  <literal>ADD</>, <literal>SET</>, and <literal>DROP</>
119       specify the action to be performed.  <literal>ADD</> is assumed
120       if no operation is explicitly specified.  Option names must be
121       unique; names and values are also validated using the foreign
122       data wrapper's validator function, if any.
123      </para>
124     </listitem>
125    </varlistentry>
126
127    <varlistentry>
128     <term><replaceable class="PARAMETER">new_owner</replaceable></term>
129     <listitem>
130      <para>
131       The user name of the new owner of the foreign-data wrapper.
132      </para>
133     </listitem>
134    </varlistentry>
135
136    <varlistentry>
137     <term><replaceable class="parameter">new_name</replaceable></term>
138     <listitem>
139      <para>
140       The new name for the foreign-data wrapper.
141      </para>
142     </listitem>
143    </varlistentry>
144   </variablelist>
145  </refsect1>
146
147  <refsect1>
148   <title>Examples</title>
149
150   <para>
151    Change a foreign-data wrapper <literal>dbi</>, add
152    option <literal>foo</>, drop <literal>bar</>:
153 <programlisting>
154 ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP 'bar');
155 </programlisting>
156   </para>
157
158   <para>
159    Change the foreign-data wrapper <literal>dbi</> validator
160    to <literal>bob.myvalidator</>:
161 <programlisting>
162 ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;
163 </programlisting></para>
164  </refsect1>
165
166  <refsect1>
167   <title>Compatibility</title>
168
169   <para>
170    <command>ALTER FOREIGN DATA WRAPPER</command> conforms to ISO/IEC
171    9075-9 (SQL/MED), except that the <literal>HANDLER</literal>,
172    <literal>VALIDATOR</>, <literal>OWNER TO</>, and <literal>RENAME</literal>
173    clauses are extensions.
174   </para>
175  </refsect1>
176
177  <refsect1>
178   <title>See Also</title>
179
180   <simplelist type="inline">
181    <member><xref linkend="sql-createforeigndatawrapper"></member>
182    <member><xref linkend="sql-dropforeigndatawrapper"></member>
183   </simplelist>
184  </refsect1>
185
186 </refentry>