Re: BUG #15602: pg_dump archive items not in correct section order

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: tcassidy(at)mossridge(dot)com(dot)au, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15602: pg_dump archive items not in correct section order
Date: 2019-02-04 17:24:32
Message-ID: 7655.1549301072@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alvaro Herrera <alvherre(at)2ndquadrant(dot)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.

Attachment Content-Type Size
fix-circular-matview-dependencies-some-more.patch text/x-diff 1.8 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2019-02-04 17:25:19 Re: to_char function returning wrong data
Previous Message Sreeni Survi 2019-02-04 17:16:06 to_char function returning wrong data