| 1 |
<!-- |
| 2 |
doc/src/sgml/ref/alter_server.sgml |
| 3 |
PostgreSQL documentation |
| 4 |
--> |
| 5 |
|
| 6 |
<refentry id="sql-alterserver"> |
| 7 |
<indexterm zone="sql-alterserver"> |
| 8 |
<primary>ALTER SERVER</primary> |
| 9 |
</indexterm> |
| 10 |
|
| 11 |
<refmeta> |
| 12 |
<refentrytitle>ALTER SERVER</refentrytitle> |
| 13 |
<manvolnum>7</manvolnum> |
| 14 |
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>ALTER SERVER</refname> |
| 19 |
<refpurpose>change the definition of a foreign server</refpurpose> |
| 20 |
</refnamediv> |
| 21 |
|
| 22 |
<refsynopsisdiv> |
| 23 |
<synopsis> |
| 24 |
ALTER SERVER <replaceable class="parameter">name</replaceable> [ VERSION '<replaceable class="parameter">new_version</replaceable>' ] |
| 25 |
[ OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ] ) ] |
| 26 |
ALTER SERVER <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } |
| 27 |
ALTER SERVER <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable> |
| 28 |
</synopsis> |
| 29 |
</refsynopsisdiv> |
| 30 |
|
| 31 |
<refsect1> |
| 32 |
<title>Description</title> |
| 33 |
|
| 34 |
<para> |
| 35 |
<command>ALTER SERVER</command> changes the definition of a foreign |
| 36 |
server. The first form changes the server version string or the |
| 37 |
generic options of the server (at least one clause is required). |
| 38 |
The second form changes the owner of the server. |
| 39 |
</para> |
| 40 |
|
| 41 |
<para> |
| 42 |
To alter the server you must be the owner of the server. |
| 43 |
Additionally to alter the owner, you must be able to |
| 44 |
<literal>SET ROLE</literal> to the new owning role, and you must |
| 45 |
have <literal>USAGE</literal> privilege on the server's foreign-data |
| 46 |
wrapper. (Note that superusers satisfy all these criteria |
| 47 |
automatically.) |
| 48 |
</para> |
| 49 |
</refsect1> |
| 50 |
|
| 51 |
<refsect1> |
| 52 |
<title>Parameters</title> |
| 53 |
|
| 54 |
<variablelist> |
| 55 |
<varlistentry> |
| 56 |
<term><replaceable class="parameter">name</replaceable></term> |
| 57 |
<listitem> |
| 58 |
<para> |
| 59 |
The name of an existing server. |
| 60 |
</para> |
| 61 |
</listitem> |
| 62 |
</varlistentry> |
| 63 |
|
| 64 |
<varlistentry> |
| 65 |
<term><replaceable class="parameter">new_version</replaceable></term> |
| 66 |
<listitem> |
| 67 |
<para> |
| 68 |
New server version. |
| 69 |
</para> |
| 70 |
</listitem> |
| 71 |
</varlistentry> |
| 72 |
|
| 73 |
<varlistentry> |
| 74 |
<term><literal>OPTIONS ( [ ADD | SET | DROP ] <replaceable class="parameter">option</replaceable> ['<replaceable class="parameter">value</replaceable>'] [, ... ] )</literal></term> |
| 75 |
<listitem> |
| 76 |
<para> |
| 77 |
Change options for the |
| 78 |
server. <literal>ADD</literal>, <literal>SET</literal>, and <literal>DROP</literal> |
| 79 |
specify the action to be performed. <literal>ADD</literal> is assumed |
| 80 |
if no operation is explicitly specified. Option names must be |
| 81 |
unique; names and values are also validated using the server's |
| 82 |
foreign-data wrapper library. |
| 83 |
</para> |
| 84 |
</listitem> |
| 85 |
</varlistentry> |
| 86 |
|
| 87 |
<varlistentry> |
| 88 |
<term><replaceable class="parameter">new_owner</replaceable></term> |
| 89 |
<listitem> |
| 90 |
<para> |
| 91 |
The user name of the new owner of the foreign server. |
| 92 |
</para> |
| 93 |
</listitem> |
| 94 |
</varlistentry> |
| 95 |
|
| 96 |
<varlistentry> |
| 97 |
<term><replaceable class="parameter">new_name</replaceable></term> |
| 98 |
<listitem> |
| 99 |
<para> |
| 100 |
The new name for the foreign server. |
| 101 |
</para> |
| 102 |
</listitem> |
| 103 |
</varlistentry> |
| 104 |
</variablelist> |
| 105 |
</refsect1> |
| 106 |
|
| 107 |
<refsect1> |
| 108 |
<title>Examples</title> |
| 109 |
|
| 110 |
<para> |
| 111 |
Alter server <literal>foo</literal>, add connection options: |
| 112 |
<programlisting> |
| 113 |
ALTER SERVER foo OPTIONS (host 'foo', dbname 'foodb'); |
| 114 |
</programlisting> |
| 115 |
</para> |
| 116 |
|
| 117 |
<para> |
| 118 |
Alter server <literal>foo</literal>, change version, |
| 119 |
change <literal>host</literal> option: |
| 120 |
<programlisting> |
| 121 |
ALTER SERVER foo VERSION '8.4' OPTIONS (SET host 'baz'); |
| 122 |
</programlisting></para> |
| 123 |
</refsect1> |
| 124 |
|
| 125 |
<refsect1> |
| 126 |
<title>Compatibility</title> |
| 127 |
|
| 128 |
<para> |
| 129 |
<command>ALTER SERVER</command> conforms to ISO/IEC 9075-9 (SQL/MED). |
| 130 |
The <literal>OWNER TO</literal> and <literal>RENAME</literal> forms are |
| 131 |
PostgreSQL extensions. |
| 132 |
</para> |
| 133 |
</refsect1> |
| 134 |
|
| 135 |
<refsect1> |
| 136 |
<title>See Also</title> |
| 137 |
|
| 138 |
<simplelist type="inline"> |
| 139 |
<member><xref linkend="sql-createserver"/></member> |
| 140 |
<member><xref linkend="sql-dropserver"/></member> |
| 141 |
</simplelist> |
| 142 |
</refsect1> |
| 143 |
|
| 144 |
</refentry> |