<listitem>
<para>
Dump only the data, not the schema (data definitions).
+ Table data, large objects, and sequence values are dumped.
</para>
<para>
- This option is equivalent to specifying <option>--section=data</>.
+ This option is similar to, but for historical reasons not identical
+ to, specifying <option>--section=data</>.
</para>
</listitem>
</varlistentry>
Dump only the object definitions (schema), not data.
</para>
<para>
- To exclude table data for only a subset of tables in the database,
- see <option>--exclude-table-data</>.
+ This option is the inverse of <option>--data-only</>.
+ It is similar to, but for historical reasons not identical to,
+ specifying
+ <option>--section=pre-data --section=post-data</>.
</para>
<para>
- This option is equivalent to specifying
- <option>--section=pre-data --section=post-data</>.
+ (Do not confuse this with the <option>--schema</> option, which
+ uses the word <quote>schema</> in a different meaning.)
+ </para>
+ <para>
+ To exclude table data for only a subset of tables in the database,
+ see <option>--exclude-table-data</>.
</para>
</listitem>
</varlistentry>
<term><option>--section=<replaceable class="parameter">sectionname</replaceable></option></term>
<listitem>
<para>
- Only dump the named section. The name can be one of <option>pre-data</>, <option>data</>
- and <option>post-data</>.
- This option can be specified more than once. The default is to dump all sections.
+ Only dump the named section. The section name can be
+ <option>pre-data</>, <option>data</>, or <option>post-data</>.
+ This option can be specified more than once to select multiple
+ sections. The default is to dump all sections.
</para>
<para>
- Post-data items consist of definitions of indexes, triggers, rules
- and constraints other than validated check constraints.
- Pre-data items consist of all other data definition items.
+ The data section contains actual table data as well as large-object
+ definitions.
+ Post-data items consist of definitions of indexes, triggers, rules
+ and constraints other than validated check constraints.
+ Pre-data items consist of all other data definition items.
</para>
</listitem>
</varlistentry>
<listitem>
<para>
Restore only the data, not the schema (data definitions).
+ Table data, large objects, and sequence values are restored,
+ if present in the archive.
</para>
+
<para>
- This option is equivalent to specifying <option>--section=data</>.
+ This option is similar to, but for historical reasons not identical
+ to, specifying <option>--section=data</>.
</para>
</listitem>
</varlistentry>
<term><option>--schema-only</option></term>
<listitem>
<para>
- Restore only the schema (data definitions), not the data (table
- contents). Current sequence values will not be restored, either.
- (Do not confuse this with the <option>--schema</> option, which
- uses the word <quote>schema</> in a different meaning.)
+ Restore only the schema (data definitions), not data,
+ to the extent that schema entries are present in the archive.
</para>
<para>
- This option is equivalent to specifying
+ This option is the inverse of <option>--data-only</>.
+ It is similar to, but for historical reasons not identical to,
+ specifying
<option>--section=pre-data --section=post-data</>.
</para>
+ <para>
+ (Do not confuse this with the <option>--schema</> option, which
+ uses the word <quote>schema</> in a different meaning.)
+ </para>
</listitem>
</varlistentry>
<term><option>--section=<replaceable class="parameter">sectionname</replaceable></option></term>
<listitem>
<para>
- Only restore the named section. The name can be one of <option>pre-data</>, <option>data</>
- and <option>post-data</>.
- This option can be specified more than once. The default is to restore all sections.
+ Only restore the named section. The section name can be
+ <option>pre-data</>, <option>data</>, or <option>post-data</>.
+ This option can be specified more than once to select multiple
+ sections. The default is to restore all sections.
</para>
<para>
- Post-data items consist of definitions of indexes, triggers, rules
- and constraints other than validated check constraints.
- Pre-data items consist of all other data definition items.
+ The data section contains actual table data as well as large-object
+ definitions.
+ Post-data items consist of definitions of indexes, triggers, rules
+ and constraints other than validated check constraints.
+ Pre-data items consist of all other data definition items.
</para>
</listitem>
</varlistentry>
#include <ctype.h>
#include "dumputils.h"
-#include "pg_backup.h"
#include "parser/keywords.h"
}
+/*
+ * Parse a --section=foo command line argument.
+ *
+ * Set or update the bitmask in *dumpSections according to arg.
+ * dumpSections is initialised as DUMP_UNSECTIONED by pg_dump and
+ * pg_restore so they can know if this has even been called.
+ */
+void
+set_dump_section(const char *arg, int *dumpSections)
+{
+ /* if this is the first call, clear all the bits */
+ if (*dumpSections == DUMP_UNSECTIONED)
+ *dumpSections = 0;
+
+ if (strcmp(arg,"pre-data") == 0)
+ *dumpSections |= DUMP_PRE_DATA;
+ else if (strcmp(arg,"data") == 0)
+ *dumpSections |= DUMP_DATA;
+ else if (strcmp(arg,"post-data") == 0)
+ *dumpSections |= DUMP_POST_DATA;
+ else
+ {
+ fprintf(stderr, _("%s: unknown section name \"%s\")\n"),
+ progname, arg);
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
+ progname);
+ exit_nicely(1);
+ }
+}
+
+
/*
* Write a printf-style message to stderr.
*
exit_nicely(1);
}
-/*
- * Set the bitmask in dumpSections according to the first argument.
- * dumpSections is initialised as DUMP_UNSECTIONED by pg_dump and
- * pg_restore so they can know if this has even been called.
- */
-
-void
-set_section (const char *arg, int *dumpSections)
-{
- /* if this is the first, clear all the bits */
- if (*dumpSections == DUMP_UNSECTIONED)
- *dumpSections = 0;
-
- if (strcmp(arg,"pre-data") == 0)
- *dumpSections |= DUMP_PRE_DATA;
- else if (strcmp(arg,"data") == 0)
- *dumpSections |= DUMP_DATA;
- else if (strcmp(arg,"post-data") == 0)
- *dumpSections |= DUMP_POST_DATA;
- else
- {
- fprintf(stderr, _("%s: unknown section name \"%s\")\n"),
- progname, arg);
- fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
- progname);
- exit_nicely(1);
- }
-}
-
/* Register a callback to be run when exit_nicely is invoked. */
void
on_exit_nicely(on_exit_nicely_callback function, void *arg)