Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 60 additions & 15 deletions doc/src/sgml/ref/pg_dump.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ PostgreSQL documentation
<term><option>--data-only</option></term>
<listitem>
<para>
Dump only the data, not the schema (data definitions).
Dump only the data, not the schema (data definitions) or statistics.
Table data, large objects, and sequence values are dumped.
</para>

Expand All @@ -137,13 +137,15 @@ PostgreSQL documentation
<listitem>
<para>
Include large objects in the dump. This is the default behavior
except when <option>--schema</option>, <option>--table</option>, or
<option>--schema-only</option> is specified. The <option>-b</option>
switch is therefore only useful to add large objects to dumps
where a specific schema or table has been requested. Note that
large objects are considered data and therefore will be included when
<option>--data-only</option> is used, but not
when <option>--schema-only</option> is.
except when <option>--schema</option>, <option>--table</option>,
<option>--schema-only</option>, <option>--statistics-only</option>, or
<option>--no-data</option> is specified. The <option>-b</option>
switch is therefore only useful to add large objects to dumps where a
specific schema or table has been requested. Note that large objects
are considered data and therefore will be included when
<option>--data-only</option> is used, but not when
<option>--schema-only</option> or <option>--statistics-only</option>
is.
</para>
</listitem>
</varlistentry>
Expand Down Expand Up @@ -512,10 +514,11 @@ PostgreSQL documentation
<term><option>--schema-only</option></term>
<listitem>
<para>
Dump only the object definitions (schema), not data.
Dump only the object definitions (schema), not data or statistics.
</para>
<para>
This option is the inverse of <option>--data-only</option>.
This option is mutually exclusive to <option>--data-only</option>
and <option>--statistics-only</option>.
It is similar to, but for historical reasons not identical to,
specifying
<option>--section=pre-data --section=post-data</option>.
Expand Down Expand Up @@ -648,6 +651,17 @@ PostgreSQL documentation
</listitem>
</varlistentry>

<varlistentry>
<term><option>--statistics-only</option></term>
<listitem>
<para>
Dump only the statistics, not the schema (data definitions) or data.
Statistics for tables, materialized views, and indexes are dumped.
</para>

</listitem>
</varlistentry>

<varlistentry>
<term><option>-Z <replaceable class="parameter">level</replaceable></option></term>
<term><option>-Z <replaceable class="parameter">method</replaceable></option>[:<replaceable>detail</replaceable>]</term>
Expand Down Expand Up @@ -737,7 +751,8 @@ PostgreSQL documentation
<term><option>--disable-triggers</option></term>
<listitem>
<para>
This option is relevant only when creating a data-only dump.
This option is relevant only when creating a dump that includes data
but does not include schema.
It instructs <application>pg_dump</application> to include commands
to temporarily disable triggers on the target tables while
the data is restored. Use this if you have referential
Expand Down Expand Up @@ -829,7 +844,8 @@ PostgreSQL documentation
though you do not need the data in it.
</para>
<para>
To exclude data for all tables in the database, see <option>--schema-only</option>.
To exclude data for all tables in the database, see <option>--schema-only</option>
or <option>--statistics-only</option>.
</para>
</listitem>
</varlistentry>
Expand Down Expand Up @@ -1076,6 +1092,15 @@ PostgreSQL documentation
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-data</option></term>
<listitem>
<para>
Do not dump data.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-publications</option></term>
<listitem>
Expand All @@ -1094,6 +1119,24 @@ PostgreSQL documentation
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-schema</option></term>
<listitem>
<para>
Do not dump schema (data definitions).
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-statistics</option></term>
<listitem>
<para>
Do not dump statistics.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-subscriptions</option></term>
<listitem>
Expand Down Expand Up @@ -1232,9 +1275,11 @@ PostgreSQL documentation
</para>
<para>
The data section contains actual table data, large-object
contents, and sequence values.
contents, statitistics for tables and materialized views and
sequence values.
Post-data items include definitions of indexes, triggers, rules,
and constraints other than validated check constraints.
statistics for indexes, and constraints other than validated check
constraints.
Pre-data items include all other data definition items.
</para>
</listitem>
Expand Down Expand Up @@ -1577,7 +1622,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
</para>

<para>
When a data-only dump is chosen and the option <option>--disable-triggers</option>
When a dump without schema is chosen and the option <option>--disable-triggers</option>
is used, <application>pg_dump</application> emits commands
to disable triggers on user tables before inserting the data,
and then commands to re-enable them after the data has been
Expand Down
41 changes: 39 additions & 2 deletions doc/src/sgml/ref/pg_dumpall.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ PostgreSQL documentation
<term><option>--data-only</option></term>
<listitem>
<para>
Dump only the data, not the schema (data definitions).
Dump only the data, not the schema (data definitions) or statistics.
</para>
</listitem>
</varlistentry>
Expand Down Expand Up @@ -265,6 +265,16 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--statistics-only</option></term>
<listitem>
<para>
Dump only the statistics, not the schema (data definitions) or data.
Statistics for tables, materialized views, and indexes are dumped.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--binary-upgrade</option></term>
<listitem>
Expand Down Expand Up @@ -307,7 +317,7 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
<term><option>--disable-triggers</option></term>
<listitem>
<para>
This option is relevant only when creating a data-only dump.
This option is relevant only when creating a dump with data and without schema.
It instructs <application>pg_dumpall</application> to include commands
to temporarily disable triggers on the target tables while
the data is restored. Use this if you have referential
Expand Down Expand Up @@ -422,6 +432,15 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-data</option></term>
<listitem>
<para>
Do not dump data.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-publications</option></term>
<listitem>
Expand All @@ -447,6 +466,15 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-schema</option></term>
<listitem>
<para>
Do not dump schema (data definitions).
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-security-labels</option></term>
<listitem>
Expand All @@ -456,6 +484,15 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-statistics</option></term>
<listitem>
<para>
Do not dump statistics.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-subscriptions</option></term>
<listitem>
Expand Down
48 changes: 44 additions & 4 deletions doc/src/sgml/ref/pg_restore.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ PostgreSQL documentation
<term><option>--data-only</option></term>
<listitem>
<para>
Restore only the data, not the schema (data definitions).
Restore only the data, not the schema (data definitions) or statistics.
Table data, large objects, and sequence values are restored,
if present in the archive.
</para>
Expand Down Expand Up @@ -483,10 +483,11 @@ PostgreSQL documentation
to the extent that schema entries are present in the archive.
</para>
<para>
This option is the inverse of <option>--data-only</option>.
This option is mutually exclusive of <option>--data-only</option>
and <option>--statistics-only</option>.
It is similar to, but for historical reasons not identical to,
specifying
<option>--section=pre-data --section=post-data</option>.
<option>--section=pre-data --section=post-data --no-statistics</option>.
</para>
<para>
(Do not confuse this with the <option>--schema</option> option, which
Expand Down Expand Up @@ -599,6 +600,15 @@ PostgreSQL documentation
</listitem>
</varlistentry>

<varlistentry>
<term><option>--statistics-only</option></term>
<listitem>
<para>
Restore only the statistics, not schema (data definitions) or data.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>-1</option></term>
<term><option>--single-transaction</option></term>
Expand All @@ -617,7 +627,7 @@ PostgreSQL documentation
<term><option>--disable-triggers</option></term>
<listitem>
<para>
This option is relevant only when performing a data-only restore.
This option is relevant only when performing a restore without schema.
It instructs <application>pg_restore</application> to execute commands
to temporarily disable triggers on the target tables while
the data is restored. Use this if you have referential
Expand Down Expand Up @@ -681,6 +691,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-data</option></term>
<listitem>
<para>
Do not output commands to restore data, even if the archive
contains them.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-data-for-failed-tables</option></term>
<listitem>
Expand Down Expand Up @@ -713,6 +733,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-schema</option></term>
<listitem>
<para>
Do not output commands to restore schema (data definitions), even if
the archive contains them.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-security-labels</option></term>
<listitem>
Expand All @@ -723,6 +753,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-statistics</option></term>
<listitem>
<para>
Do not output commands to restore statistics, even if the archive
contains them.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-subscriptions</option></term>
<listitem>
Expand Down
9 changes: 9 additions & 0 deletions doc/src/sgml/ref/pgupgrade.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ PostgreSQL documentation
</listitem>
</varlistentry>

<varlistentry>
<term><option>--no-statistics</option></term>
<listitem>
<para>
Do not restore statistics from the old cluster into the new cluster.
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><option>-o</option> <replaceable class="parameter">options</replaceable></term>
<term><option>--old-options</option> <replaceable class="parameter">options</replaceable></term>
Expand Down
10 changes: 10 additions & 0 deletions src/bin/pg_dump/pg_backup.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ typedef struct _restoreOptions
int enable_row_security;
int sequence_data; /* dump sequence data even in schema-only mode */
int binary_upgrade;

/* flags derived from the user-settable flags */
bool dumpSchema;
bool dumpData;
bool dumpStatistics;
} RestoreOptions;

typedef struct _dumpOptions
Expand Down Expand Up @@ -203,6 +208,11 @@ typedef struct _dumpOptions

int sequence_data; /* dump sequence data even in schema-only mode */
int do_nothing;

/* flags derived from the user-settable flags */
bool dumpSchema;
bool dumpData;
bool dumpStatistics;
} DumpOptions;

/*
Expand Down
Loading
Loading