diff options
| author | Bruce Momjian <bruce@momjian.us> | 2013-03-30 22:20:53 -0400 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2013-03-30 22:20:53 -0400 |
| commit | fb7890aedbd4d67bc1ddee65f9249f5b6ccc9d49 (patch) | |
| tree | 3e9a94af42ecdada6e069a1a99518d5dfa4a008c /contrib/pg_upgrade/info.c | |
| parent | 01accb380b11b7b874601c6c14c0554a83f35958 (diff) | |
pg_upgrade: don't copy/link files for invalid indexes
Now that pg_dump no longer dumps invalid indexes, per commit
683abc73dff549e94555d4020dae8d02f32ed78b, have pg_upgrade also skip
them. Previously pg_upgrade threw an error if invalid indexes existed.
Backpatch to 9.2, 9.1, and 9.0 (where pg_upgrade was added to git)
Diffstat (limited to 'contrib/pg_upgrade/info.c')
| -rw-r--r-- | contrib/pg_upgrade/info.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/pg_upgrade/info.c b/contrib/pg_upgrade/info.c index 02d3e0f52f0..271c27ce730 100644 --- a/contrib/pg_upgrade/info.c +++ b/contrib/pg_upgrade/info.c @@ -325,6 +325,8 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo, "FROM pg_catalog.pg_class c JOIN " " pg_catalog.pg_namespace n " " ON c.relnamespace = n.oid " + " LEFT OUTER JOIN pg_catalog.pg_index i " + " ON c.oid = i.indexrelid " " LEFT OUTER JOIN pg_catalog.pg_tablespace t " " ON c.reltablespace = t.oid " "WHERE (( " @@ -338,7 +340,11 @@ get_rel_infos(migratorContext *ctx, const DbInfo *dbinfo, " n.nspname = 'pg_catalog' " " AND relname IN " " ('pg_largeobject', 'pg_largeobject_loid_pn_index'%s) )) " - " AND relkind IN ('r','t', 'i'%s)" + " AND relkind IN ('r','t', 'i'%s) " + /* pg_dump only dumps valid indexes; testing indisready is + * necessary in 9.2, and harmless in earlier/later versions. */ + " AND i.indisvalid IS DISTINCT FROM false AND " + " i.indisready IS DISTINCT FROM false " "GROUP BY c.oid, n.nspname, c.relname, c.relfilenode," " c.reltoastrelid, c.reltablespace, t.spclocation, " " n.nspname " |
