Re: Change in "policy" on dump ordering?

Jim Nasby <jim.nasby@bluetreble.com>

From: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: Michael Banck <michael.banck@credativ.de>, Stephen Frost <sfrost@snowman.net>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2017-02-23T00:18:17Z
Lists: pgsql-hackers
On 2/22/17 5:38 PM, Michael Banck wrote:
>> diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c
>> index ea643397ba..708a47f3cb 100644
>> --- a/src/bin/pg_dump/pg_dump_sort.c
>> +++ b/src/bin/pg_dump/pg_dump_sort.c
>> @@ -26,6 +26,9 @@ static const char *modulename = gettext_noop("sorter");
>>   * Sort priority for database object types.
>>   * Objects are sorted by type, and within a type by name.
>>   *
>> + * Because materialized views can potentially reference system views,
>> + * DO_REFRESH_MATVIEW should always be the last thing on the list.
>> + *
> I think this comment is overly specific: any materialized view that
> references a view or table in a different schema (pg_catalog or not)
> will likely not refresh on pg_restore AIUI, so singling out system views
> doesn't look right to me.

This isn't a matter of excluded schemas. The problem is that if you had 
a matview that referenced a system view for something that was restored 
after DO_REFRESH_MATVIEW (such as subscriptions) then the view would be 
inaccurate after the restore.

Stephen, hopefully that answers your question as well. :)
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)


Commits

  1. Fix pg_dump/pg_restore to emit REFRESH MATERIALIZED VIEW commands last.