1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

pg_dump: Allow dumping data of specific foreign servers

The new command-line switch --include-foreign-data=PATTERN lets the user
specify foreign servers from which to dump foreign table data.  This can
be refined by further inclusion/exclusion switches, so that the user has
full control over which tables to dump.

A limitation is that this doesn't work in combination with parallel
dumps, for implementation reasons.  This might be lifted in the future,
but requires shuffling some code around.

Author: Luis Carril <luis.carril@swarm64.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Surafel Temesgen <surafel3000@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@2ndQuadrant.com>
Discussion: https://postgr.es/m/LEJPR01MB0185483C0079D2F651B16231E7FC0@LEJPR01MB0185.DEUPRD01.PROD.OUTLOOK.DE
This commit is contained in:
Alvaro Herrera
2020-03-25 13:19:31 -03:00
parent bda6dedbea
commit 2f9eb31320
5 changed files with 185 additions and 6 deletions

View File

@@ -767,6 +767,36 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>--include-foreign-data=<replaceable class="parameter">foreignserver</replaceable></option></term>
<listitem>
<para>
Dump the data for any foreign table with a foreign server
matching <replaceable class="parameter">foreignserver</replaceable>
pattern. Multiple foreign servers can be selected by writing multiple
<option>--include-foreign-data</option> switches.
Also, the <replaceable class="parameter">foreignserver</replaceable> parameter is
interpreted as a pattern according to the same rules used by
<application>psql</application>'s <literal>\d</literal> commands (see <xref
linkend="app-psql-patterns" endterm="app-psql-patterns-title"/>),
so multiple foreign servers can also be selected by writing wildcard characters
in the pattern. When using wildcards, be careful to quote the pattern
if needed to prevent the shell from expanding the wildcards; see
<xref linkend="pg-dump-examples" endterm="pg-dump-examples-title"/>.
The only exception is that an empty pattern is disallowed.
</para>
<note>
<para>
When <option>--include-foreign-data</option> is specified,
<application>pg_dump</application> does not check that the foreign
table is writeable. Therefore, there is no guarantee that the
results of a foreign table dump can be successfully restored.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--inserts</option></term>
<listitem>