| 1 |
<!-- |
| 2 |
doc/src/sgml/ref/alter_foreign_data_wrapper.sgml |
| 3 |
PostgreSQL documentation |
| 4 |
--> |
| 5 |
|
| 6 |
<refentry id="sql-alterforeigndatawrapper"> |
| 7 |
<indexterm zone="sql-alterforeigndatawrapper"> |
| 8 |
<primary>ALTER FOREIGN DATA WRAPPER</primary> |
| 9 |
</indexterm> |
| 10 |
|
| 11 |
<refmeta> |
| 12 |
<refentrytitle>ALTER FOREIGN DATA WRAPPER</refentrytitle> |
| 13 |
<manvolnum>7</manvolnum> |
| 14 |
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>ALTER FOREIGN DATA WRAPPER</refname> |
| 19 |
<refpurpose>change the definition of a foreign-data wrapper</refpurpose> |
| 20 |
</refnamediv> |
| 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> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } |
| 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 pre-existing options of the foreign-data |
| 95 |
wrapper, or of dependent servers, user mappings, or foreign tables, are |
| 96 |
invalid according to the new validator. <productname>PostgreSQL</productname> does |
| 97 |
not check for this. It is up to the user to make sure that these |
| 98 |
options are correct before using the modified foreign-data wrapper. |
| 99 |
However, any options specified in this <command>ALTER FOREIGN DATA |
| 100 |
WRAPPER</command> command will be checked using the new validator. |
| 101 |
</para> |
| 102 |
</listitem> |
| 103 |
</varlistentry> |
| 104 |
|
| 105 |
<varlistentry> |
| 106 |
<term><literal>NO VALIDATOR</literal></term> |
| 107 |
<listitem> |
| 108 |
<para> |
| 109 |
This is used to specify that the foreign-data wrapper should no |
| 110 |
longer have a validator function. |
| 111 |
</para> |
| 112 |
</listitem> |
| 113 |
</varlistentry> |
| 114 |
|
| 115 |
<varlistentry> |
| 116 |
<term><literal>OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ] )</literal></term> |
| 117 |
<listitem> |
| 118 |
<para> |
| 119 |
Change options for the foreign-data |
| 120 |
wrapper. <literal>ADD</literal>, <literal>SET</literal>, and <literal>DROP</literal> |
| 121 |
specify the action to be performed. <literal>ADD</literal> is assumed |
| 122 |
if no operation is explicitly specified. Option names must be |
| 123 |
unique; names and values are also validated using the foreign |
| 124 |
data wrapper's validator function, if any. |
| 125 |
</para> |
| 126 |
</listitem> |
| 127 |
</varlistentry> |
| 128 |
|
| 129 |
<varlistentry> |
| 130 |
<term><replaceable class="parameter">new_owner</replaceable></term> |
| 131 |
<listitem> |
| 132 |
<para> |
| 133 |
The user name of the new owner of the foreign-data wrapper. |
| 134 |
</para> |
| 135 |
</listitem> |
| 136 |
</varlistentry> |
| 137 |
|
| 138 |
<varlistentry> |
| 139 |
<term><replaceable class="parameter">new_name</replaceable></term> |
| 140 |
<listitem> |
| 141 |
<para> |
| 142 |
The new name for the foreign-data wrapper. |
| 143 |
</para> |
| 144 |
</listitem> |
| 145 |
</varlistentry> |
| 146 |
</variablelist> |
| 147 |
</refsect1> |
| 148 |
|
| 149 |
<refsect1> |
| 150 |
<title>Examples</title> |
| 151 |
|
| 152 |
<para> |
| 153 |
Change a foreign-data wrapper <literal>dbi</literal>, add |
| 154 |
option <literal>foo</literal>, drop <literal>bar</literal>: |
| 155 |
<programlisting> |
| 156 |
ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP bar); |
| 157 |
</programlisting> |
| 158 |
</para> |
| 159 |
|
| 160 |
<para> |
| 161 |
Change the foreign-data wrapper <literal>dbi</literal> validator |
| 162 |
to <literal>bob.myvalidator</literal>: |
| 163 |
<programlisting> |
| 164 |
ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator; |
| 165 |
</programlisting></para> |
| 166 |
</refsect1> |
| 167 |
|
| 168 |
<refsect1> |
| 169 |
<title>Compatibility</title> |
| 170 |
|
| 171 |
<para> |
| 172 |
<command>ALTER FOREIGN DATA WRAPPER</command> conforms to ISO/IEC |
| 173 |
9075-9 (SQL/MED), except that the <literal>HANDLER</literal>, |
| 174 |
<literal>VALIDATOR</literal>, <literal>OWNER TO</literal>, and <literal>RENAME</literal> |
| 175 |
clauses are extensions. |
| 176 |
</para> |
| 177 |
</refsect1> |
| 178 |
|
| 179 |
<refsect1> |
| 180 |
<title>See Also</title> |
| 181 |
|
| 182 |
<simplelist type="inline"> |
| 183 |
<member><xref linkend="sql-createforeigndatawrapper"/></member> |
| 184 |
<member><xref linkend="sql-dropforeigndatawrapper"/></member> |
| 185 |
</simplelist> |
| 186 |
</refsect1> |
| 187 |
|
| 188 |
</refentry> |