Re: BUG #15602: pg_dump archive items not in correct section order
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: tcassidy@mossridge.com.au, pgsql-bugs@lists.postgresql.org
Date: 2019-02-04T17:24:32Z
Lists: pgsql-bugs
Attachments
- fix-circular-matview-dependencies-some-more.patch (text/x-diff) patch
Alvaro Herrera <alvherre@2ndquadrant.com> writes: > On 2019-Jan-22, PG Bug reporting form wrote: >> When I run pg_dump on a database, it reports the following warning: >> pg_dump: [archiver] WARNING: archive items not in correct section order >> >> The following SQL script replicates the warning when run on a new instance >> of PostgreSQL 11.1: > It does indeed ... curious. Hmph. What this shows is that commit 62215de29 was a few bricks shy of a load. It got rid of this symptom for the case of a matview that's dependent on a table's primary key (meaning we have to postpone the matview creation into the post-data section of the archive), but I did not think about additional matviews that are dependent on the one with the circularity problem. They all have to get postponed, and the dependency logic correctly fixes that ... but it doesn't mark all of them as "postponed_def", so that they don't get labeled with SECTION_POST_DATA and then ProcessArchiveRestoreOptions thinks something is wrong. Basically this is sloppy thinking in repairMatViewBoundaryMultiLoop: the thing that's getting moved to post-data is whatever we just removed the pre-data dependency for. The attached seems to be enough to fix it. Tom, are you in a position to rebuild pg_dump with this fix applied, and see if it cures your original case as well as the simplified one? regards, tom lane PS: It's surprising that it took this long for anyone to notice. PPS: We really ought to get off our duffs and invent CREATE OR REPLACE for matviews, so that these loops can be fixed in a less unprincipled fashion.
Commits
-
Fix dumping of matviews with indirect dependencies on primary keys.
- dc42602f1f6d 10.7 landed
- b8de846a511a 11.2 landed
- 9368ba174faf 9.5.16 landed
- 6e4d45b5f6ba 12.0 landed
- 2f93b74bf362 9.4.21 landed
- 16e0464a11d8 9.6.12 landed
-
Fix dumping of a materialized view that depends on a table's primary key.
- 62215de29257 9.4.0 cited