Docs: consolidate dependency notes in pg_dump and pg_restore

The pg_dump documentation had repetitive notes for the --schema,
--table, and --extension switches, noting that dependent database
objects are not automatically included in the dump.  This commit removes
these notes and replaces them with a consolidated paragraph in the
"Notes" section.

pg_restore had a similar note for -t but lacked one for -n; do likewise.

Also, add a note to --extension in pg_dump to note that ancillary files
(such as shared libraries and control files) are not included in the
dump and must be present on the destination system.

Author: Florents Tselai <florents.tselai@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/284C4D55-4F90-4AA0-84C8-1E6A28DDF271@gmail.com
This commit is contained in:
Álvaro Herrera 2026-02-03 19:29:15 +01:00
parent 57bff90160
commit 78bf28e3bf
No known key found for this signature in database
GPG key ID: 1C20ACB9D5C564AE
2 changed files with 25 additions and 36 deletions

View file

@ -263,12 +263,10 @@ PostgreSQL documentation
<note>
<para>
When <option>-e</option> is specified,
<application>pg_dump</application> makes no attempt to dump any other
database objects that the selected extension(s) might depend upon.
Therefore, there is no guarantee that the results of a
specific-extension dump can be successfully restored by themselves
into a clean database.
<application>pg_dump</application> does not dump the extension's
underlying installation files (such as shared libraries or control
files). These must be available on the destination system for the
restore to succeed.
</para>
</note>
</listitem>
@ -445,16 +443,6 @@ PostgreSQL documentation
<xref linkend="pg-dump-examples"/> below.
</para>
<note>
<para>
When <option>-n</option> is specified, <application>pg_dump</application>
makes no attempt to dump any other database objects that the selected
schema(s) might depend upon. Therefore, there is no guarantee
that the results of a specific-schema dump can be successfully
restored by themselves into a clean database.
</para>
</note>
<note>
<para>
Non-schema objects such as large objects are not dumped when <option>-n</option> is
@ -596,16 +584,6 @@ PostgreSQL documentation
be dumped.
</para>
<note>
<para>
When <option>-t</option> is specified, <application>pg_dump</application>
makes no attempt to dump any other database objects that the selected
table(s) might depend upon. Therefore, there is no guarantee
that the results of a specific-table dump can be successfully
restored by themselves into a clean database.
</para>
</note>
</listitem>
</varlistentry>
@ -1689,6 +1667,17 @@ CREATE DATABASE foo WITH TEMPLATE template0;
</programlisting>
</para>
<para>
When options <option>-e</option>, <option>-n</option> or <option>-t</option>
are specified, <application>pg_dump</application> makes no attempt to dump
any other database objects that the selected object(s) might depend upon.
Therefore, there is no guarantee that the results of a dump so generated
can be successfully restored by themselves into a clean database.
For example, if a table whose definition includes a foreign key is
specified to be restored, the table referenced by the foreign key is
not automatically restored.
</para>
<para>
When a dump without schema is chosen and the option <option>--disable-triggers</option>
is used, <application>pg_dump</application> emits commands

View file

@ -452,16 +452,6 @@ PostgreSQL documentation
specify table(s) in a particular schema.
</para>
<note>
<para>
When <option>-t</option> is specified, <application>pg_restore</application>
makes no attempt to restore any other database objects that the
selected table(s) might depend upon. Therefore, there is no
guarantee that a specific-table restore into a clean database will
succeed.
</para>
</note>
<note>
<para>
This flag does not behave identically to the <option>-t</option>
@ -1089,6 +1079,16 @@ PostgreSQL documentation
<refsect1 id="app-pgrestore-notes">
<title>Notes</title>
<para>
When options <option>-n</option> or <option>-t</option> are specified,
<application>pg_restore</application> makes no attempt to restore
any other database objects that the selected table(s) or schema(s)
might depend upon. Therefore, there is no guarantee that a specific-table
restore into a clean database will succeed. For example, if a table
whose definition includes a foreign key is specified to be restored, the
table referenced by the foreign key is not automatically restored.
</para>
<para>
If your installation has any local additions to the
<literal>template1</literal> database, be careful to load the output of