• T
    Rewrite --section option to decouple it from --schema-only/--data-only. · 4317e024
    Tom Lane 提交于
    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.
    4317e024
pg_restore.c 12.5 KB