Home Explore Blog CI



postgresql

1st chunk of `doc/src/sgml/ref/create_server.sgml`
b684f5c0037f964fa53b40917cd5a6f259bc8c938747701f00000001000009ca
<!--
doc/src/sgml/ref/create_server.sgml
PostgreSQL documentation
-->

<refentry id="sql-createserver">
 <indexterm zone="sql-createserver">
  <primary>CREATE SERVER</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>CREATE SERVER</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>CREATE SERVER</refname>
  <refpurpose>define a new foreign server</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
<synopsis>
CREATE SERVER [ IF NOT EXISTS ] <replaceable class="parameter">server_name</replaceable> [ TYPE '<replaceable class="parameter">server_type</replaceable>' ] [ VERSION '<replaceable class="parameter">server_version</replaceable>' ]
    FOREIGN DATA WRAPPER <replaceable class="parameter">fdw_name</replaceable>
    [ OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [, ... ] ) ]
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>CREATE SERVER</command> defines a new foreign server.  The
   user who defines the server becomes its owner.
  </para>

  <para>
   A foreign server typically encapsulates connection information that
   a foreign-data wrapper uses to access an external data resource.
   Additional user-specific connection information may be specified by
   means of user mappings.
  </para>

  <para>
   The server name must be unique within the database.
  </para>

  <para>
   Creating a server requires <literal>USAGE</literal> privilege on the
   foreign-data wrapper being used.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <variablelist>
  <varlistentry>
    <term><literal>IF NOT EXISTS</literal></term>
    <listitem>
     <para>
      Do not throw an error if a server with the same name already exists.
      A notice is issued in this case.  Note that there is no guarantee that
      the existing server is anything like the one that would have been
      created.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">server_name</replaceable></term>
    <listitem>
     <para>
      The name of the foreign server to be created.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">server_type</replaceable></term>
    <listitem>
     <para>
      Optional server type, potentially useful to foreign-data wrappers.
     </para>
    </listitem>

Title: CREATE SERVER: Define a New Foreign Server
Summary
The CREATE SERVER command defines a new foreign server, which encapsulates connection information used by foreign-data wrappers to access external data resources. The server name must be unique within the database, and creating a server requires USAGE privilege on the foreign-data wrapper. The IF NOT EXISTS option prevents errors if a server with the same name already exists.