Skip to content

Commit d77ff69

Browse files
committed
pg_dump: Fix ordering
Materialized views refresh should be last. From: Jim Nasby <Jim.Nasby@BlueTreble.com>
1 parent 272adf4 commit d77ff69

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/bin/pg_dump/pg_dump_sort.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ static const char *modulename = gettext_noop("sorter");
2626
* Sort priority for database object types.
2727
* Objects are sorted by type, and within a type by name.
2828
*
29+
* Because materialized views can potentially reference system views,
30+
* DO_REFRESH_MATVIEW should always be the last thing on the list.
31+
*
2932
* NOTE: object-type priorities must match the section assignments made in
3033
* pg_dump.c; that is, PRE_DATA objects must sort before DO_PRE_DATA_BOUNDARY,
3134
* POST_DATA objects must sort after DO_POST_DATA_BOUNDARY, and DATA objects
@@ -70,11 +73,11 @@ static const int dbObjectTypePriority[] =
7073
22,/* DO_PRE_DATA_BOUNDARY */
7174
26,/* DO_POST_DATA_BOUNDARY */
7275
33,/* DO_EVENT_TRIGGER */
73-
34,/* DO_REFRESH_MATVIEW */
74-
35,/* DO_POLICY */
75-
36,/* DO_PUBLICATION */
76-
37,/* DO_PUBLICATION_REL */
77-
38/* DO_SUBSCRIPTION */
76+
38,/* DO_REFRESH_MATVIEW */
77+
34,/* DO_POLICY */
78+
35,/* DO_PUBLICATION */
79+
36,/* DO_PUBLICATION_REL */
80+
37/* DO_SUBSCRIPTION */
7881
};
7982

8083
static DumpId preDataBoundId;

0 commit comments

Comments
 (0)