pgsql: Rewrite --section option to decouple it from --schema-only/--dat - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Rewrite --section option to decouple it from --schema-only/--dat
Date
Msg-id E1SZZUT-0007ij-4p@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/4317e0246c645f60c39e6572644cff1cb03b4c65

Modified Files
--------------
doc/src/sgml/ref/pg_dump.sgml        |   33 +++++---
doc/src/sgml/ref/pg_restore.sgml     |   35 +++++---
src/bin/pg_dump/dumputils.c          |   61 +++++++------
src/bin/pg_dump/dumputils.h          |   14 +++-
src/bin/pg_dump/pg_backup.h          |   15 +---
src/bin/pg_dump/pg_backup_archiver.c |  162 +++++++++++++++++++--------------
src/bin/pg_dump/pg_backup_archiver.h |   14 ++--
src/bin/pg_dump/pg_backup_tar.c      |   10 ++-
src/bin/pg_dump/pg_dump.c            |   93 +++++++------------
src/bin/pg_dump/pg_restore.c         |   39 +-------
10 files changed, 238 insertions(+), 238 deletions(-)


pgsql-committers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pgsql: Eliminate some more O(N^2) behaviors in pg_dump/pg_restore.
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Change the way parent pages are tracked during buffered GiST bui