pgsql: In pg_dump, ensure that view triggers are processed after view r - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: In pg_dump, ensure that view triggers are processed after view r
Date
Msg-id E1aRCR7-0003Pa-1l@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
In pg_dump, ensure that view triggers are processed after view rules.

If a view is split into CREATE TABLE + CREATE RULE to break a circular
dependency, then any triggers on the view must be dumped/reloaded after
the CREATE RULE; else the backend may reject the CREATE TRIGGER because
it's the wrong type of trigger for a plain table.  This works all right
in plain dump/restore because of pg_dump's sorting heuristic that places
triggers after rules.  However, when using parallel restore, the ordering
must be enforced by a dependency --- and we didn't have one.

Fixing this is a mere matter of adding an addObjectDependency() call,
except that we need to be able to find all the triggers belonging to the
view relation, and there was no easy way to do that.  Add fields to
pg_dump's TableInfo struct to remember where the associated TriggerInfo
struct(s) are.

Per bug report from Dennis Kögel.  The failure can be exhibited at least
as far back as 9.1, so back-patch to all supported branches.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/411e2b0d59947b8fce39906b4722781895e31b1e

Modified Files
--------------
src/bin/pg_dump/pg_dump.c      | 3 +++
src/bin/pg_dump/pg_dump.h      | 2 ++
src/bin/pg_dump/pg_dump_sort.c | 4 ++++
3 files changed, 9 insertions(+)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: In pg_dump, ensure that view triggers are processed after view r
Next
From: Tom Lane
Date:
Subject: pgsql: In pg_dump, ensure that view triggers are processed after view r