pgsql: Fix pg_dump handling of extension config tables - Mailing list pgsql-committers

From Stephen Frost
Subject pgsql: Fix pg_dump handling of extension config tables
Date
Msg-id E1YSVm2-00038g-QI@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix pg_dump handling of extension config tables

Since 9.1, we've provided extensions with a way to denote
"configuration" tables- tables created by an extension which the user
may modify.  By marking these as "configuration" tables, the extension
is asking for the data in these tables to be pg_dump'd (tables which
are not marked in this way are assumed to be entirely handled during
CREATE EXTENSION and are not included at all in a pg_dump).

Unfortunately, pg_dump neglected to consider foreign key relationships
between extension configuration tables and therefore could end up
trying to reload the data in an order which would cause FK violations.

This patch teaches pg_dump about these dependencies, so that the data
dumped out is done so in the best order possible.  Note that there's no
way to handle circular dependencies, but those have yet to be seen in
the wild.

The release notes for this should include a caution to users that
existing pg_dump-based backups may be invalid due to this issue.  The
data is all there, but restoring from it will require extracting the
data for the configuration tables and then loading them in the correct
order by hand.

Discussed initially back in bug #6738, more recently brought up by
Gilles Darold, who provided an initial patch which was further reworked
by Michael Paquier.  Further modifications and documentation updates
by me.

Back-patch to 9.1 where we added the concept of extension configuration
tables.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/43d81f16a393cbc233bbb5d8314c4148cf5a5d68

Modified Files
--------------
doc/src/sgml/extend.sgml  |   11 +++++++
src/bin/pg_dump/pg_dump.c |   78 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 88 insertions(+), 1 deletion(-)


pgsql-committers by date:

Previous
From: Stephen Frost
Date:
Subject: pgsql: Fix pg_dump handling of extension config tables
Next
From: Robert Haas
Date:
Subject: pgsql: pgbench: Add a real expression syntax to \set