summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-03-26 17:43:26 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-03-26 17:43:26 -0400
commit30de42d254d7b31161bfd0388677712694108906 (patch)
tree6fe43dcd1e7c7721910363a9bd447f7638fd1121 /src
parent2e4acef357c6eec6b6ae8a7a3b464c96e3f343c7 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dump.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 964823f5e67..c7a5abd5e4c 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -4534,6 +4534,7 @@ getIndexes(TableInfo tblinfo[], int numTables)
"i.indexrelid = c.conindid AND "
"c.contype IN ('p','u','x')) "
"WHERE i.indrelid = '%u'::pg_catalog.oid "
+ "AND i.indisvalid "
"ORDER BY indexname",
tbinfo->dobj.catId.oid);
}
@@ -4562,6 +4563,7 @@ getIndexes(TableInfo tblinfo[], int numTables)
"ON (d.refclassid = c.tableoid "
"AND d.refobjid = c.oid) "
"WHERE i.indrelid = '%u'::pg_catalog.oid "
+ "AND i.indisvalid "
"ORDER BY indexname",
tbinfo->dobj.catId.oid);
}