Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 522400a

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 5869cbf commit 522400a

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
@@ -437,6 +437,41 @@
437437
</para>
438438
</sect2>
439439

440+
<sect2>
441+
<title>Remote Query Execution Environment</title>
442+
443+
<para>
444+
In the remote sessions opened by <filename>postgres_fdw</>,
445+
the <xref linkend="guc-search-path"> parameter is set to
446+
just <literal>pg_catalog</>, so that only built-in objects are visible
447+
without schema qualification. This is not an issue for queries
448+
generated by <filename>postgres_fdw</> itself, because it always
449+
supplies such qualification. However, this can pose a hazard for
450+
functions that are executed on the remote server via triggers or rules
451+
on remote tables. For example, if a remote table is actually a view,
452+
any functions used in that view will be executed with the restricted
453+
search path. It is recommended to schema-qualify all names in such
454+
functions, or else attach <literal>SET search_path</> options
455+
(see <xref linkend="sql-createfunction">) to such functions
456+
to establish their expected search path environment.
457+
</para>
458+
459+
<para>
460+
<filename>postgres_fdw</> likewise establishes remote session settings
461+
for the parameters <xref linkend="guc-timezone">,
462+
<xref linkend="guc-datestyle">, <xref linkend="guc-intervalstyle">,
463+
and <xref linkend="guc-extra-float-digits">. These are less likely
464+
to be problematic than <varname>search_path</>, but can be handled
465+
with function <literal>SET</> options if the need arises.
466+
</para>
467+
468+
<para>
469+
It is <emphasis>not</> recommended that you override this behavior by
470+
changing the session-level settings of these parameters; that is likely
471+
to cause <filename>postgres_fdw</> to malfunction.
472+
</para>
473+
</sect2>
474+
440475
<sect2>
441476
<title>Cross-Version Compatibility</title>
442477

0 commit comments

Comments
 (0)