summaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
blob: 1c82db9e0385f7efb751dedd8b00d890dac4b353 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!--
doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
PostgreSQL documentation
-->

<refentry id="SQL-ALTERFOREIGNDATAWRAPPER">
 <indexterm zone="sql-alterforeigndatawrapper">
  <primary>ALTER FOREIGN DATA WRAPPER</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>ALTER FOREIGN DATA WRAPPER</refentrytitle>
  <manvolnum>7</manvolnum>
  <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>
    [ HANDLER <replaceable class="parameter">handler_function</replaceable> | NO HANDLER ]
    [ VALIDATOR <replaceable class="parameter">validator_function</replaceable> | NO VALIDATOR ]
    [ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ]) ]
ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> OWNER TO <replaceable>new_owner</replaceable>
ALTER FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
</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
   command changes the support functions or the generic options of the
   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>
    <term><literal>HANDLER <replaceable class="parameter">handler_function</replaceable></literal></term>
    <listitem>
     <para>
      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.
     </para>

     <para>
      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.
     </para>
    </listitem>
   </varlistentry>

   <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>

   <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
      data wrapper's validator function, if any.
     </para>
    </listitem>
   </varlistentry>

   <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>
  </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>
   Change the foreign-data wrapper <literal>dbi</> validator
   to <literal>bob.myvalidator</>:
<programlisting>
ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;
</programlisting></para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   <command>ALTER FOREIGN DATA WRAPPER</command> conforms to ISO/IEC
   9075-9 (SQL/MED), except that the <literal>HANDLER</literal>,
   <literal>VALIDATOR</>, <literal>OWNER TO</>, and <literal>RENAME</literal>
   clauses are extensions.
  </para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-createforeigndatawrapper"></member>
   <member><xref linkend="sql-dropforeigndatawrapper"></member>
  </simplelist>
 </refsect1>

</refentry>