text: <!--
  doc/src/sgml/ref/import_foreign_schema.sgml
  PostgreSQL documentation
  -->
  
  <refentry id="sql-importforeignschema">
  <!--==========================orignal english content==========================
   <indexterm zone="sql-importforeignschema">
    <primary>IMPORT FOREIGN SCHEMA</primary>
   </indexterm>
  ____________________________________________________________________________-->
   <indexterm zone="sql-importforeignschema">
    <primary>IMPORT FOREIGN SCHEMA</primary>
   </indexterm>
  
  <!--==========================orignal english content==========================
   <refmeta>
    <refentrytitle>IMPORT FOREIGN SCHEMA</refentrytitle>
    <manvolnum>7</manvolnum>
    <refmiscinfo>SQL - Language Statements</refmiscinfo>
   </refmeta>
  ____________________________________________________________________________-->
   <refmeta>
    <refentrytitle>IMPORT FOREIGN SCHEMA</refentrytitle>
    <manvolnum>7</manvolnum>
    <refmiscinfo>SQL - Language Statements</refmiscinfo>
   </refmeta>
  
  <!--==========================orignal english content==========================
   <refnamediv>
    <refname>IMPORT FOREIGN SCHEMA</refname>
    <refpurpose>import table definitions from a foreign server</refpurpose>
   </refnamediv>
  ____________________________________________________________________________-->
   <refnamediv>
    <refname>IMPORT FOREIGN SCHEMA</refname>
    <refpurpose>从一个外部服务器导入表定义</refpurpose>
   </refnamediv>
  
   <refsynopsisdiv>
  <!--==========================orignal english content==========================
  <synopsis>
  IMPORT FOREIGN SCHEMA <replaceable class="parameter">remote_schema</replaceable>
      [ { LIMIT TO | EXCEPT } ( <replaceable class="parameter">table_name</replaceable> [, ...] ) ]
      FROM SERVER <replaceable class="parameter">server_name</replaceable>
      INTO <replaceable class="parameter">local_schema</replaceable>
      [ OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [, ... ] ) ]
  </synopsis>
  ____________________________________________________________________________-->
  <synopsis>
  IMPORT FOREIGN SCHEMA <replaceable class="parameter">remote_schema</replaceable>
      [ { LIMIT TO | EXCEPT } ( <replaceable class="parameter">table_name</replaceable> [, ...] ) ]
      FROM SERVER <replaceable class="parameter">server_name</replaceable>
      INTO <replaceable class="parameter">local_schema</replaceable>
      [ OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [, ... ] ) ]
  </synopsis>
   </refsynopsisdiv>
  
   <refsect1 id="sql-importforeignschema-description">
  <!--==========================orignal english content==========================
    <title>Description</title>
  ____________________________________________________________________________-->
    <title>简介</title>
  
  <!--==========================orignal english content==========================
    <para>
     <command>IMPORT FOREIGN SCHEMA</command> creates foreign tables that
     represent tables existing on a foreign server.  The new foreign tables
     will be owned by the user issuing the command and are created with
     the correct column definitions and options to match the remote tables.
    </para>
  ____________________________________________________________________________-->
    <para>
     <command>IMPORT FOREIGN SCHEMA</command>创建表示存在于
     外部服务器上的表的外部表。新外部表将由发出该命令的用户所拥有并且用
     匹配远程表的正确的列定义和选项创建。
    </para>
  
  <!--==========================orignal english content==========================
    <para>
     By default, all tables and views existing in a particular schema on the
     foreign server are imported.  Optionally, the list of tables can be limited
     to a specified subset, or specific tables can be excluded.  The new foreign
     tables are all created in the target schema, which must already exist.
    </para>
  ____________________________________________________________________________-->
    <para>
     默认情况下，存在于外部服务器上一个特定模式中的所有表和视图都会被导入。
     根据需要，表的列表可以被限制到一个指定的子集，或者可以排除特定的表。
     新外部表都被创建在一个必须已经存在的目标模式中。
    </para>
  
  <!--==========================orignal english content==========================
    <para>
     To use <command>IMPORT FOREIGN SCHEMA</command>, the user must have
     <literal>USAGE</literal> privilege on the foreign server, as well as
     <literal>CREATE</literal> privilege on the target schema.
    </para>
  ____________________________________________________________________________-->
    <para>
     要使用<command>IMPORT FOREIGN SCHEMA</command>，用户必
     须具有外部服务器上的<literal>USAGE</literal>特权以及在目标模式上的
     <literal>CREATE</literal>特权。
    </para>
   </refsect1>
  
   <refsect1>
  <!--==========================orignal english content==========================
    <title>Parameters</title>
  ____________________________________________________________________________-->
    <title>参数</title>
  
    <variablelist>
  
     <varlistentry>
  <!--==========================orignal english content==========================
      <term><replaceable class="parameter">remote_schema</replaceable></term>
  ____________________________________________________________________________-->
      <term><replaceable class="parameter">remote_schema</replaceable></term>
      <listitem>
  <!--==========================orignal english content==========================
       <para>
        The remote schema to import from. The specific meaning of a remote schema
        depends on the foreign data wrapper in use.
       </para>
  ____________________________________________________________________________-->
       <para>
        要从哪个远程模式导入。一个远程模式的特定含义依赖于所使用的外部数据包装器。
       </para>
      </listitem>
     </varlistentry>
  
     <varlistentry>
  <!--==========================orignal english content==========================
      <term><literal>LIMIT TO ( <replaceable class="parameter">table_name</replaceable> [, ...] )</literal></term>
  ____________________________________________________________________________-->
      <term><literal>LIMIT TO ( <replaceable class="parameter">table_name</replaceable> [, ...] )</literal></term>
      <listitem>
  <!--==========================orignal english content==========================
       <para>
        Import only foreign tables matching one of the given table names.
        Other tables existing in the foreign schema will be ignored.
       </para>
  ____________________________________________________________________________-->
       <para>
        只导入匹配给定表名之一的外部表。外部模式中其他的表将被忽略。
       </para>
      </listitem>
     </varlistentry>
  
     <varlistentry>
  <!--==========================orignal english content==========================
      <term><literal>EXCEPT ( <replaceable class="parameter">table_name</replaceable> [, ...] )</literal></term>
  ____________________________________________________________________________-->
      <term><literal>EXCEPT ( <replaceable class="parameter">table_name</replaceable> [, ...] )</literal></term>
      <listitem>
  <!--==========================orignal english content==========================
       <para>
        Exclude specified foreign tables from the import.  All tables
        existing in the foreign schema will be imported except the
        ones listed here.
       </para>
  ____________________________________________________________________________-->
       <para>
        把指定的外部表排除在导入之外。除了列在这里的表之外，外部模式
        中存在的所有表都将被导入。
       </para>
      </listitem>
     </varlistentry>
  
     <varlistentry>
  <!--==========================orignal english content==========================
      <term><replaceable class="parameter">server_name</replaceable></term>
  ____________________________________________________________________________-->
      <term><replaceable class="parameter">server_name</replaceable></term>
      <listitem>
  <!--==========================orignal english content==========================
       <para>
        The foreign server to import from.
       </para>
  ____________________________________________________________________________-->
       <para>
        要从哪个外部服务器导入。
       </para>
      </listitem>
     </varlistentry>
  
     <varlistentry>
  <!--==========================orignal english content==========================
      <term><replaceable class="parameter">local_schema</replaceable></term>
  ____________________________________________________________________________-->
      <term><replaceable class="parameter">local_schema</replaceable></term>
      <listitem>
  <!--==========================orignal english content==========================
       <para>
        The schema in which the imported foreign tables will be created.
       </para>
  ____________________________________________________________________________-->
       <para>
        被导入的外部表将创建在其中的模式。
       </para>
      </listitem>
     </varlistentry>
  
     <varlistentry>
  <!--==========================orignal english content==========================
      <term><literal>OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [, ...] )</literal></term>
  ____________________________________________________________________________-->
      <term><literal>OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [, ...] )</literal></term>
      <listitem>
  <!--==========================orignal english content==========================
       <para>
        Options to be used during the import.
        The allowed option names and values are specific to each foreign
        data wrapper.
       </para>
  ____________________________________________________________________________-->
       <para>
        要在导入期间使用的选项。允许使用的选项名称和值与每一个外部数据包装器
        有关。
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </refsect1>
  
   <refsect1 id="sql-importforeignschema-examples">
  <!--==========================orignal english content==========================
    <title>Examples</title>
  ____________________________________________________________________________-->
    <title>示例</title>
  
  <!--==========================orignal english content==========================
    <para>
     Import table definitions from a remote schema <structname>foreign_films</structname>
     on server <structname>film_server</structname>, creating the foreign tables in
     local schema <structname>films</structname>:
  
  <programlisting>
  IMPORT FOREIGN SCHEMA foreign_films
      FROM SERVER film_server INTO films;
  </programlisting>
     </para>
  ____________________________________________________________________________-->
    <para>
     从服务器<structname>film_server</structname>上的远程模式<structname>foreign_films</structname>
     中导入表定义，把外部表创建在本地模式<structname>films</structname>中：
  
  <programlisting>
  IMPORT FOREIGN SCHEMA foreign_films
      FROM SERVER film_server INTO films;
  </programlisting>
     </para>
  
  <!--==========================orignal english content==========================
    <para>
     As above, but import only the two tables <structname>actors</structname> and
     <literal>directors</literal> (if they exist):
  
  <programlisting>
  IMPORT FOREIGN SCHEMA foreign_films LIMIT TO (actors, directors)
      FROM SERVER film_server INTO films;
  </programlisting></para>
  ____________________________________________________________________________-->
    <para>
     同上，但是只导入两个表<structname>actors</structname>和
     <literal>directors</literal>（如果存在）：
  
  <programlisting>
  IMPORT FOREIGN SCHEMA foreign_films LIMIT TO (actors, directors)
      FROM SERVER film_server INTO films;
  </programlisting></para>
   </refsect1>
  
   <refsect1 id="sql-importforeignschema-compatibility">
  <!--==========================orignal english content==========================
    <title>Compatibility</title>
  ____________________________________________________________________________-->
    <title>兼容性</title>
  
  <!--==========================orignal english content==========================
    <para>
     The <command>IMPORT FOREIGN SCHEMA</command> command conforms to the
     <acronym>SQL</acronym> standard, except that the <literal>OPTIONS</literal>
     clause is a <productname>PostgreSQL</productname> extension.
    </para>
  ____________________________________________________________________________-->
    <para>
     <command>IMPORT FOREIGN SCHEMA</command>命令符合
     <acronym>SQL</acronym>标准，不过<literal>OPTIONS</literal>
     子句是一种<productname>PostgreSQL</productname>扩展。
    </para>
  
   </refsect1>
  
   <refsect1>
  <!--==========================orignal english content==========================
    <title>See Also</title>
  ____________________________________________________________________________-->
    <title>另见</title>
  
    <simplelist type="inline">
     <member><xref linkend="sql-createforeigntable"/></member>
     <member><xref linkend="sql-createserver"/></member>
    </simplelist>
   </refsect1>
  </refentry>
  