1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

pg_upgrade: don't copy/link files for invalid indexes

Now that pg_dump no longer dumps invalid indexes, per commit
683abc73df, 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)
This commit is contained in:
Bruce Momjian
2013-03-30 22:20:53 -04:00
parent 01accb380b
commit fb7890aedb
2 changed files with 7 additions and 93 deletions

View File

@ -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 "