codekingpro/portable-devtools
115k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ALTER FOREIGN DATA WRAPPER</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-alterextension.html" title="ALTER EXTENSION" /><link rel="next" href="sql-alterforeigntable.html" title="ALTER FOREIGN TABLE" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">ALTER FOREIGN DATA WRAPPER</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-alterextension.html" title="ALTER EXTENSION">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-alterforeigntable.html" title="ALTER FOREIGN TABLE">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-ALTERFOREIGNDATAWRAPPER"><div class="titlepage"></div><a id="id-1.9.3.12.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">ALTER FOREIGN DATA WRAPPER</span></h2><p>ALTER FOREIGN DATA WRAPPER — change the definition of a foreign-data wrapper</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">3ALTER FOREIGN DATA WRAPPER <em class="replaceable"><code>name</code></em>4 [ HANDLER <em class="replaceable"><code>handler_function</code></em> | NO HANDLER ]5 [ VALIDATOR <em class="replaceable"><code>validator_function</code></em> | NO VALIDATOR ]6 [ OPTIONS ( [ ADD | SET | DROP ] <em class="replaceable"><code>option</code></em> ['<em class="replaceable"><code>value</code></em>'] [, ... ]) ]7ALTER FOREIGN DATA WRAPPER <em class="replaceable"><code>name</code></em> OWNER TO { <em class="replaceable"><code>new_owner</code></em> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }8ALTER FOREIGN DATA WRAPPER <em class="replaceable"><code>name</code></em> RENAME TO <em class="replaceable"><code>new_name</code></em>9</pre></div><div class="refsect1" id="id-1.9.3.12.5"><h2>Description</h2><p>10 <code class="command">ALTER FOREIGN DATA WRAPPER</code> changes the11 definition of a foreign-data wrapper. The first form of the12 command changes the support functions or the generic options of the13 foreign-data wrapper (at least one clause is required). The second14 form changes the owner of the foreign-data wrapper.15 </p><p>16 Only superusers can alter foreign-data wrappers. Additionally,17 only superusers can own foreign-data wrappers.18 </p></div><div class="refsect1" id="id-1.9.3.12.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd><p>19 The name of an existing foreign-data wrapper.20 </p></dd><dt><span class="term"><code class="literal">HANDLER <em class="replaceable"><code>handler_function</code></em></code></span></dt><dd><p>21 Specifies a new handler function for the foreign-data wrapper.22 </p></dd><dt><span class="term"><code class="literal">NO HANDLER</code></span></dt><dd><p>23 This is used to specify that the foreign-data wrapper should no24 longer have a handler function.25 </p><p>26 Note that foreign tables that use a foreign-data wrapper with no27 handler cannot be accessed.28 </p></dd><dt><span class="term"><code class="literal">VALIDATOR <em class="replaceable"><code>validator_function</code></em></code></span></dt><dd><p>29 Specifies a new validator function for the foreign-data wrapper.30 </p><p>31 Note that it is possible that pre-existing options of the foreign-data32 wrapper, or of dependent servers, user mappings, or foreign tables, are33 invalid according to the new validator. <span class="productname">PostgreSQL</span> does34 not check for this. It is up to the user to make sure that these35 options are correct before using the modified foreign-data wrapper.36 However, any options specified in this <code class="command">ALTER FOREIGN DATA37 WRAPPER</code> command will be checked using the new validator.38 </p></dd><dt><span class="term"><code class="literal">NO VALIDATOR</code></span></dt><dd><p>39 This is used to specify that the foreign-data wrapper should no40 longer have a validator function.41 </p></dd><dt><span class="term"><code class="literal">OPTIONS ( [ ADD | SET | DROP ] <em class="replaceable"><code>option</code></em> ['<em class="replaceable"><code>value</code></em>'] [, ... ] )</code></span></dt><dd><p>42 Change options for the foreign-data43 wrapper. <code class="literal">ADD</code>, <code class="literal">SET</code>, and <code class="literal">DROP</code>44 specify the action to be performed. <code class="literal">ADD</code> is assumed45 if no operation is explicitly specified. Option names must be46 unique; names and values are also validated using the foreign47 data wrapper's validator function, if any.48 </p></dd><dt><span class="term"><em class="replaceable"><code>new_owner</code></em></span></dt><dd><p>49 The user name of the new owner of the foreign-data wrapper.50 </p></dd><dt><span class="term"><em class="replaceable"><code>new_name</code></em></span></dt><dd><p>51 The new name for the foreign-data wrapper.52 </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.12.7"><h2>Examples</h2><p>53 Change a foreign-data wrapper <code class="literal">dbi</code>, add54 option <code class="literal">foo</code>, drop <code class="literal">bar</code>:55</p><pre class="programlisting">56ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP bar);57</pre><p>58 </p><p>59 Change the foreign-data wrapper <code class="literal">dbi</code> validator60 to <code class="literal">bob.myvalidator</code>:61</p><pre class="programlisting">62ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;63</pre></div><div class="refsect1" id="id-1.9.3.12.8"><h2>Compatibility</h2><p>64 <code class="command">ALTER FOREIGN DATA WRAPPER</code> conforms to ISO/IEC65 9075-9 (SQL/MED), except that the <code class="literal">HANDLER</code>,66 <code class="literal">VALIDATOR</code>, <code class="literal">OWNER TO</code>, and <code class="literal">RENAME</code>67 clauses are extensions.68 </p></div><div class="refsect1" id="id-1.9.3.12.9"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-createforeigndatawrapper.html" title="CREATE FOREIGN DATA WRAPPER"><span class="refentrytitle">CREATE FOREIGN DATA WRAPPER</span></a>, <a class="xref" href="sql-dropforeigndatawrapper.html" title="DROP FOREIGN DATA WRAPPER"><span class="refentrytitle">DROP FOREIGN DATA WRAPPER</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-alterextension.html" title="ALTER EXTENSION">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-alterforeigntable.html" title="ALTER FOREIGN TABLE">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ALTER EXTENSION </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> ALTER FOREIGN TABLE</td></tr></table></div></body></html>