Home Explore Blog CI



postgresql

9th chunk of `doc/src/sgml/postgres-fdw.sgml`
4018e1a13192dda68470a1635ee76a5fb0ba2e7ef39322810000000100000fba
 <listitem>
      <para>
       This option controls whether <filename>postgres_fdw</filename> allows foreign
       tables to be modified using <command>INSERT</command>, <command>UPDATE</command> and
       <command>DELETE</command> commands.  It can be specified for a foreign table
       or a foreign server.  A table-level option overrides a server-level
       option.
       The default is <literal>true</literal>.
      </para>

      <para>
       Of course, if the remote table is not in fact updatable, an error
       would occur anyway.  Use of this option primarily allows the error to
       be thrown locally without querying the remote server.  Note however
       that the <literal>information_schema</literal> views will report a
       <filename>postgres_fdw</filename> foreign table to be updatable (or not)
       according to the setting of this option, without any check of the
       remote server.
      </para>
     </listitem>
    </varlistentry>

   </variablelist>
  </sect3>

  <sect3 id="postgres-fdw-options-truncatability">
   <title>Truncatability Options</title>

   <para>
    By default all foreign tables using <filename>postgres_fdw</filename> are assumed
    to be truncatable.  This may be overridden using the following option:
   </para>

   <variablelist>

    <varlistentry>
     <term><literal>truncatable</literal> (<type>boolean</type>)</term>
     <listitem>
      <para>
       This option controls whether <filename>postgres_fdw</filename> allows
       foreign tables to be truncated using the <command>TRUNCATE</command>
       command. It can be specified for a foreign table or a foreign server.
       A table-level option overrides a server-level option.
       The default is <literal>true</literal>.
      </para>

      <para>
       Of course, if the remote table is not in fact truncatable, an error
       would occur anyway.  Use of this option primarily allows the error to
       be thrown locally without querying the remote server.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </sect3>

  <sect3 id="postgres-fdw-options-importing">
   <title>Importing Options</title>

   <para>
    <filename>postgres_fdw</filename> is able to import foreign table definitions
    using <xref linkend="sql-importforeignschema"/>.  This command creates
    foreign table definitions on the local server that match tables or
    views present on the remote server.  If the remote tables to be imported
    have columns of user-defined data types, the local server must have
    compatible types of the same names.
   </para>

   <para>
    Importing behavior can be customized with the following options
    (given in the <command>IMPORT FOREIGN SCHEMA</command> command):
   </para>

   <variablelist>
    <varlistentry>
     <term><literal>import_collate</literal> (<type>boolean</type>)</term>
     <listitem>
      <para>
       This option controls whether column <literal>COLLATE</literal> options
       are included in the definitions of foreign tables imported
       from a foreign server. The default is <literal>true</literal>.  You might
       need to turn this off if the remote server has a different set of
       collation names than the local server does, which is likely to be the
       case if it's running on a different operating system.
       If you do so, however, there is a very severe risk that the imported
       table columns' collations will not match the underlying data, resulting
       in anomalous query behavior.
      </para>

      <para>
       Even when this parameter is set to <literal>true</literal>, importing
       columns whose collation is the remote server's default can be risky.
       They will be imported with <literal>COLLATE "default"</literal>, which
       will select the local server's default collation, which could be
       different.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><literal>import_default</literal> (<type>boolean</type>)</term>

Title: Postgres FDW Options for Truncatability and Importing
Summary
The postgres_fdw foreign data wrapper provides options to control truncatability, allowing foreign tables to be truncated using the TRUNCATE command, and importing options, such as import_collate and import_default, to customize the behavior of importing foreign table definitions using the IMPORT FOREIGN SCHEMA command.