Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/postgres-fdw.sgml`
c25835516cbe72b3bd44210e4c25cebcd7ee3dc4fab3ab180000000100000fa1
 modifying the remote table.
 </para>

 <para>
  Note that <filename>postgres_fdw</filename> currently lacks support for
  <command>INSERT</command> statements with an <literal>ON CONFLICT DO
  UPDATE</literal> clause.  However, the <literal>ON CONFLICT DO NOTHING</literal>
  clause is supported, provided a unique index inference specification
  is omitted.
  Note also that <filename>postgres_fdw</filename> supports row movement
  invoked by <command>UPDATE</command> statements executed on partitioned
  tables, but it currently does not handle the case where a remote partition
  chosen to insert a moved row into is also an <command>UPDATE</command>
  target partition that will be updated elsewhere in the same command.
 </para>

 <para>
  It is generally recommended that the columns of a foreign table be declared
  with exactly the same data types, and collations if applicable, as the
  referenced columns of the remote table.  Although <filename>postgres_fdw</filename>
  is currently rather forgiving about performing data type conversions at
  need, surprising semantic anomalies may arise when types or collations do
  not match, due to the remote server interpreting query conditions
  differently from the local server.
 </para>

 <para>
  Note that a foreign table can be declared with fewer columns, or with a
  different column order, than its underlying remote table has.  Matching
  of columns to the remote table is by name, not position.
 </para>

 <sect2 id="postgres-fdw-options">
  <title>FDW Options of postgres_fdw</title>

  <sect3 id="postgres-fdw-options-connection">
   <title>Connection Options</title>

   <para>
    A foreign server using the <filename>postgres_fdw</filename> foreign data wrapper
    can have the same options that <application>libpq</application> accepts in
    connection strings, as described in <xref linkend="libpq-paramkeywords"/>,
    except that these options are not allowed or have special handling:

    <itemizedlist spacing="compact">
     <listitem>
      <para>
       <literal>user</literal>, <literal>password</literal> and <literal>sslpassword</literal> (specify these
       in a user mapping instead, or use a service file)
      </para>
     </listitem>
     <listitem>
      <para>
       <literal>client_encoding</literal> (this is automatically set from the local
       server encoding)
      </para>
     </listitem>
     <listitem>
      <para>
       <literal>application_name</literal> - this may appear in
       <emphasis>either or both</emphasis> a connection and
       <xref linkend="guc-pgfdw-application-name"/>.
       If both are present, <varname>postgres_fdw.application_name</varname>
       overrides the connection setting.
       Unlike <application>libpq</application>,
       <filename>postgres_fdw</filename> allows
       <varname>application_name</varname> to include
       <quote>escape sequences</quote>.
       See <xref linkend="guc-pgfdw-application-name"/> for details.
      </para>
     </listitem>
     <listitem>
      <para>
       <literal>fallback_application_name</literal> (always set to
       <literal>postgres_fdw</literal>)
      </para>
     </listitem>
     <listitem>
      <para>
       <literal>sslkey</literal> and <literal>sslcert</literal> - these may
       appear in <emphasis>either or both</emphasis> a connection and a user
       mapping. If both are present, the user mapping setting overrides the
       connection setting.
      </para>
     </listitem>
    </itemizedlist>
   </para>

   <para>
    Only superusers may create or modify user mappings with the
    <literal>sslcert</literal> or <literal>sslkey</literal> settings.
   </para>
   <para>
    Non-superusers may connect to foreign servers using password
    authentication or with GSSAPI delegated credentials, so specify the
    <literal>password</literal> option for user mappings belonging to
    non-superusers where password authentication is required.
   </para>
   <para>
    A superuser may

Title: Postgres FDW Options and Connection Settings
Summary
The postgres_fdw foreign data wrapper has various options for connecting to external PostgreSQL servers, including connection options like user, password, and SSL settings, which can be specified in a foreign server or user mapping, with some options having special handling or restrictions for non-superusers.