Home Explore Blog CI



postgresql

17th chunk of `doc/src/sgml/postgres-fdw.sgml`
eeb5467428b3c59f1199625c031cec5de6a0309078a7b9e40000000100000fbe
 for queries
   generated by <filename>postgres_fdw</filename> itself, because it always
   supplies such qualification.  However, this can pose a hazard for
   functions that are executed on the remote server via triggers or rules
   on remote tables.  For example, if a remote table is actually a view,
   any functions used in that view will be executed with the restricted
   search path.  It is recommended to schema-qualify all names in such
   functions, or else attach <literal>SET search_path</literal> options
   (see <xref linkend="sql-createfunction"/>) to such functions
   to establish their expected search path environment.
  </para>

  <para>
   <filename>postgres_fdw</filename> likewise establishes remote session settings
   for various parameters:
   <itemizedlist spacing="compact">
    <listitem>
     <para>
      <xref linkend="guc-timezone"/> is set to <literal>UTC</literal>
     </para>
    </listitem>
    <listitem>
     <para>
      <xref linkend="guc-datestyle"/> is set to <literal>ISO</literal>
     </para>
    </listitem>
    <listitem>
     <para>
      <xref linkend="guc-intervalstyle"/> is set to <literal>postgres</literal>
     </para>
    </listitem>
    <listitem>
     <para>
      <xref linkend="guc-extra-float-digits"/> is set to <literal>3</literal> for remote
      servers 9.0 and newer and is set to <literal>2</literal> for older versions
     </para>
    </listitem>
   </itemizedlist>
   These are less likely to be problematic than <varname>search_path</varname>, but
   can be handled with function <literal>SET</literal> options if the need arises.
  </para>

  <para>
   It is <emphasis>not</emphasis> recommended that you override this behavior by
   changing the session-level settings of these parameters; that is likely
   to cause <filename>postgres_fdw</filename> to malfunction.
  </para>
 </sect2>

 <sect2 id="postgres-fdw-cross-version-compatibility">
  <title>Cross-Version Compatibility</title>

  <para>
   <filename>postgres_fdw</filename> can be used with remote servers dating back
   to <productname>PostgreSQL</productname> 8.3.  Read-only capability is available
   back to 8.1.
  </para>
  <para>
   A limitation however is that <filename>postgres_fdw</filename>
   generally assumes that immutable built-in functions and operators are
   safe to send to the remote server for execution, if they appear in a
   <literal>WHERE</literal> clause for a foreign table.  Thus, a built-in
   function that was added since the remote server's release might be sent
   to it for execution, resulting in <quote>function does not exist</quote> or
   a similar error.  This type of failure can be worked around by
   rewriting the query, for example by embedding the foreign table
   reference in a sub-<literal>SELECT</literal> with <literal>OFFSET 0</literal> as an
   optimization fence, and placing the problematic function or operator
   outside the sub-<literal>SELECT</literal>.
  </para>
  <para>
   Another limitation is that when executing <command>INSERT</command>
   statements with an <literal>ON CONFLICT DO NOTHING</literal> clause on
   a foreign table, the remote server must be running
   <productname>PostgreSQL</productname> 9.5 or later,
   as earlier versions do not support this feature.
  </para>
 </sect2>

 <sect2 id="postgres-fdw-wait-events">
  <title>Wait Events</title>

  <para>
   <filename>postgres_fdw</filename> can report the following wait events
   under the wait event type <literal>Extension</literal>:
  </para>

  <variablelist>
   <varlistentry>
    <term><literal>PostgresFdwCleanupResult</literal></term>
    <listitem>
     <para>
      Waiting for transaction abort on remote server.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>PostgresFdwConnect</literal></term>
    <listitem>
     <para>
      Waiting to establish a connection to a remote server.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>PostgresFdwGetResult</literal></term>

Title: Postgres FDW Configuration and Compatibility
Summary
Postgres FDW establishes remote session settings for parameters like timezone, datestyle, and intervalstyle, and recommends against overriding this behavior. It also supports cross-version compatibility with remote servers dating back to PostgreSQL 8.3, but has limitations such as assuming immutable built-in functions are safe to send to the remote server and requiring PostgreSQL 9.5 or later for INSERT statements with ON CONFLICT DO NOTHING clauses. Additionally, Postgres FDW reports wait events like PostgresFdwCleanupResult, PostgresFdwConnect, and PostgresFdwGetResult under the Extension wait event type.