Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 683abc7

Browse files
committed
Ignore invalid indexes in pg_dump.
Dumping invalid indexes can cause problems at restore time, for example if the reason the index creation failed was because it tried to enforce a uniqueness condition not satisfied by the table's data. Also, if the index creation is in fact still in progress, it seems reasonable to consider it to be an uncommitted DDL change, which pg_dump wouldn't be expected to dump anyway. Back-patch to all active versions, and teach them to ignore invalid indexes in servers back to 8.2, where the concept was introduced. Michael Paquier
1 parent 625b237 commit 683abc7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4920,6 +4920,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
49204920
"i.indexrelid = c.conindid AND "
49214921
"c.contype IN ('p','u','x')) "
49224922
"WHERE i.indrelid = '%u'::pg_catalog.oid "
4923+
"AND i.indisvalid "
49234924
"ORDER BY indexname",
49244925
tbinfo->dobj.catId.oid);
49254926
}
@@ -4949,6 +4950,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables)
49494950
"ON (d.refclassid = c.tableoid "
49504951
"AND d.refobjid = c.oid) "
49514952
"WHERE i.indrelid = '%u'::pg_catalog.oid "
4953+
"AND i.indisvalid "
49524954
"ORDER BY indexname",
49534955
tbinfo->dobj.catId.oid);
49544956
}

0 commit comments

Comments
 (0)