Add manvolnum, so that man pages are generated.
[PostgreSQL.git] / doc / src / sgml / ref / create_server.sgml
blob39f8bf0d94baa53969f4127a4f045fcb800b3639
1 <!--
2 $PostgreSQL$
3 PostgreSQL documentation
4 -->
6 <refentry id="SQL-CREATESERVER">
7 <refmeta>
8 <refentrytitle id="sql-createserver-title">CREATE SERVER</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements</refmiscinfo>
11 </refmeta>
13 <refnamediv>
14 <refname>CREATE SERVER</refname>
15 <refpurpose>define a new foreign server</refpurpose>
16 </refnamediv>
18 <indexterm zone="sql-createserver">
19 <primary>CREATE SERVER</primary>
20 </indexterm>
22 <refsynopsisdiv>
23 <synopsis>
24 CREATE SERVER <replaceable class="parameter">servername</replaceable> [ TYPE 'servertype' ] [ VERSION 'serverversion' ]
25 FOREIGN DATA WRAPPER <replaceable class="parameter">fdwname</replaceable>
26 [ OPTIONS ( <replaceable class="PARAMETER">option</replaceable> '<replaceable class="PARAMETER">value</replaceable>' [, ... ] ) ]
27 </synopsis>
28 </refsynopsisdiv>
30 <refsect1>
31 <title>Description</title>
33 <para>
34 <command>CREATE SERVER</command> defines a new foreign server. The
35 user who defines the server becomes its owner.
36 </para>
38 <para>
39 A foreign server typically encapsulates connection information that
40 a foreign-data wrapper uses to access an external data resource.
41 Additional user-specific connection information may be specified by
42 means of user mappings.
43 </para>
45 <para>
46 The server name must be unique within the database.
47 </para>
49 <para>
50 Creating a server requires <literal>USAGE</> privilege on the
51 foreign-data wrapper being used.
52 </para>
53 </refsect1>
55 <refsect1>
56 <title>Parameters</title>
58 <variablelist>
59 <varlistentry>
60 <term><replaceable class="parameter">servername</replaceable></term>
61 <listitem>
62 <para>
63 The name of the foreign server to be created.
64 </para>
65 </listitem>
66 </varlistentry>
68 <varlistentry>
69 <term><replaceable class="parameter">servertype</replaceable></term>
70 <listitem>
71 <para>
72 Optional server type.
73 </para>
74 </listitem>
75 </varlistentry>
77 <varlistentry>
78 <term><replaceable class="parameter">serverversion</replaceable></term>
79 <listitem>
80 <para>
81 Optional server version.
82 </para>
83 </listitem>
84 </varlistentry>
86 <varlistentry>
87 <term><replaceable class="parameter">fdwname</replaceable></term>
88 <listitem>
89 <para>
90 The name of the foreign-data wrapper that manages the server.
91 </para>
92 </listitem>
93 </varlistentry>
95 <varlistentry>
96 <term><literal>OPTIONS ( <replaceable class="PARAMETER">option</replaceable> '<replaceable class="PARAMETER">value</replaceable>' [, ... ] )</literal></term>
97 <listitem>
98 <para>
99 This clause specifies the options for the server. The options
100 typically define the connection details of the server, but the
101 actual names and values are dependent on the server's
102 foreign-data wrapper.
103 </para>
104 </listitem>
105 </varlistentry>
106 </variablelist>
107 </refsect1>
109 <refsect1>
110 <title>Notes</title>
112 <para>
113 When using the <application>dblink</application> module
114 (see <xref linkend="dblink">), the foreign server name can be used
115 as an argument of the <xref linkend="contrib-dblink-connect">
116 function to indicate the connection parameters. See also there for
117 more examples. It is necessary to have
118 the <literal>USAGE</literal> privilege on the foreign server to be
119 able to use it in this way.
120 </para>
121 </refsect1>
123 <refsect1>
124 <title>Examples</title>
126 <para>
127 Create a server <literal>foo</> that uses the built-in foreign-data
128 wrapper <literal>default</>:
129 <programlisting>
130 CREATE SERVER foo FOREIGN DATA WRAPPER "default";
131 </programlisting>
132 </para>
134 <para>
135 Create a server <literal>myserver</> that uses the
136 foreign-data wrapper <literal>pgsql</>:
137 <programlisting>
138 CREATE SERVER myserver FOREIGN DATA WRAPPER pgsql OPTIONS (host 'foo', dbname 'foodb', port '5432');
139 </programlisting>
140 </para>
141 </refsect1>
143 <refsect1>
144 <title>Compatibility</title>
146 <para>
147 <command>CREATE SERVER</command> conforms to ISO/IEC 9075-9 (SQL/MED).
148 </para>
149 </refsect1>
151 <refsect1>
152 <title>See Also</title>
154 <simplelist type="inline">
155 <member><xref linkend="sql-alterserver" endterm="sql-alterserver-title"></member>
156 <member><xref linkend="sql-dropserver" endterm="sql-dropserver-title"></member>
157 <member><xref linkend="sql-createforeigndatawrapper" endterm="sql-createforeigndatawrapper-title"></member>
158 <member><xref linkend="sql-createusermapping" endterm="sql-createusermapping-title"></member>
159 </simplelist>
160 </refsect1>
162 </refentry>