Skip to content

Commit d509560

Browse files
committed
Add docs about postgres_fdw's setting of search_path and other GUCs.
This behavior wasn't documented, but it should be because it's user-visible in triggers and other functions executed on the remote server. Per question from Adam Fuchs. Back-patch to 9.3 where postgres_fdw was added.
1 parent ff2ee45 commit d509560

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

doc/src/sgml/postgres-fdw.sgml

+35
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,41 @@
355355
</para>
356356
</sect2>
357357

358+
<sect2>
359+
<title>Remote Query Execution Environment</title>
360+
361+
<para>
362+
In the remote sessions opened by <filename>postgres_fdw</>,
363+
the <xref linkend="guc-search-path"> parameter is set to
364+
just <literal>pg_catalog</>, so that only built-in objects are visible
365+
without schema qualification. This is not an issue for queries
366+
generated by <filename>postgres_fdw</> itself, because it always
367+
supplies such qualification. However, this can pose a hazard for
368+
functions that are executed on the remote server via triggers or rules
369+
on remote tables. For example, if a remote table is actually a view,
370+
any functions used in that view will be executed with the restricted
371+
search path. It is recommended to schema-qualify all names in such
372+
functions, or else attach <literal>SET search_path</> options
373+
(see <xref linkend="sql-createfunction">) to such functions
374+
to establish their expected search path environment.
375+
</para>
376+
377+
<para>
378+
<filename>postgres_fdw</> likewise establishes remote session settings
379+
for the parameters <xref linkend="guc-timezone">,
380+
<xref linkend="guc-datestyle">, <xref linkend="guc-intervalstyle">,
381+
and <xref linkend="guc-extra-float-digits">. These are less likely
382+
to be problematic than <varname>search_path</>, but can be handled
383+
with function <literal>SET</> options if the need arises.
384+
</para>
385+
386+
<para>
387+
It is <emphasis>not</> recommended that you override this behavior by
388+
changing the session-level settings of these parameters; that is likely
389+
to cause <filename>postgres_fdw</> to malfunction.
390+
</para>
391+
</sect2>
392+
358393
<sect2>
359394
<title>Cross-Version Compatibility</title>
360395

0 commit comments

Comments
 (0)