Make pg_dump emit more accurate dependency information.
While pg_dump has included dependency information in archive-format output
ever since 7.3, it never made any large effort to ensure that that
information was actually useful. In particular, in common situations where
dependency chains include objects that aren't separately emitted in the
dump, the dependencies shown for objects that were emitted would reference
the dump IDs of these un-dumped objects, leaving no clue about which other
objects the visible objects indirectly depend on. So far, parallel
pg_restore has managed to avoid tripping over this misfeature, but only
by dint of some crude hacks like not trusting dependency information in
the pre-data section of the archive.
It seems prudent to do something about this before it rises up to bite us,
so instead of emitting the "raw" dependencies of each dumped object,
recursively search for its actual dependencies among the subset of objects
that are being dumped.
Back-patch to 9.2, since that code hasn't yet diverged materially from
HEAD. At some point we might need to back-patch further, but right now
there are no known cases where this is actively necessary. (The one known
case, bug #6699, is fixed in a different way by my previous patch.) Since
this patch depends on 9.2 changes that made TOC entries be marked before
output commences as to whether they'll be dumped, back-patching further
would require additional surgery; and as of now there's no evidence that
it's worth the risk.
src/bin/pg_dump/pg_backup_archiver.c | 16 ++-
src/bin/pg_dump/pg_dump.c | 208 ++++++++++++++++++++++++++++------
2 files changed, 182 insertions(+), 42 deletions(-)
pgsql-committers by date
|Next:||From: Heikki Linnakangas||Date: 2012-06-26 04:52:03|
|Subject: pgsql: Fix pg_upgrade,broken by the xlogid/segno -> 64-bit int refacto|
|Previous:||From: Alvaro Herrera||Date: 2012-06-25 22:45:44|
|Subject: pgsql: Tighten up includes in sinvaladt.h, twophase.h, proc.h|