diff options
author | Tom Lane | 2012-05-30 03:22:14 +0000 |
---|---|---|
committer | Tom Lane | 2012-05-30 03:22:14 +0000 |
commit | 4317e0246c645f60c39e6572644cff1cb03b4c65 (patch) | |
tree | 5b2458f6ae02e6adf25d8fcc45bf6243b455b948 /doc/src | |
parent | 4bc6fb57f774ea18187fd8565aad9994160bfc17 (diff) |
Rewrite --section option to decouple it from --schema-only/--data-only.
The initial implementation of pg_dump's --section option supposed that the
existing --schema-only and --data-only options could be made equivalent to
--section settings. This is wrong, though, due to dubious but long since
set-in-stone decisions about where to dump SEQUENCE SET items, as seen in
bug report from Martin Pitt. (And I'm not totally convinced there weren't
other bugs, either.) Undo that coupling and instead drive --section
filtering off current-section state tracked as we scan through the TOC
list to call _tocEntryRequired().
To make sure those decisions don't shift around and hopefully save a few
cycles, run _tocEntryRequired() only once per TOC entry and save the result
in a new TOC field. This required minor rejiggering of ACL handling but
also allows a far cleaner implementation of inhibit_data_for_failed_table.
Also, to ensure that pg_dump and pg_restore have the same behavior with
respect to the --section switches, add _tocEntryRequired() filtering to
WriteToc() and WriteDataChunks(), rather than trying to implement section
filtering in an entirely orthogonal way in dumpDumpableObject(). This
required adjusting the handling of the special ENCODING and STDSTRINGS
items, but they were pretty weird before anyway.
Minor other code review for the patch, too.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/pg_dump.sgml | 33 | ||||
-rw-r--r-- | doc/src/sgml/ref/pg_restore.sgml | 35 |
2 files changed, 45 insertions, 23 deletions
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 12ddd259662..450383083d7 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -113,10 +113,12 @@ PostgreSQL documentation <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> @@ -403,12 +405,18 @@ PostgreSQL documentation 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> @@ -722,14 +730,17 @@ PostgreSQL documentation <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> diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index 513b946e571..bc3d2b7e90f 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -92,9 +92,13 @@ <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> @@ -357,15 +361,19 @@ <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> @@ -515,14 +523,17 @@ <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> |