aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-03-26 17:43:34 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-03-26 17:43:34 -0400
commit1173fa2a7e65a9ee65e89dcc1421a40adbb886d8 (patch)
treeb39ba31bffeafc573f7760333215f89d2bda0c40
parentf75a538c85477e4b2e4e97fed51daa298cfa64b7 (diff)
downloadpostgresql-1173fa2a7e65a9ee65e89dcc1421a40adbb886d8.tar.gz
postgresql-1173fa2a7e65a9ee65e89dcc1421a40adbb886d8.zip
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
-rw-r--r--src/bin/pg_dump/pg_dump.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 7c4730414e4..1c02ee824c3 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -3750,6 +3750,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);
}