diff options
author | Fujii Masao <fujii@postgresql.org> | 2013-07-04 03:24:09 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2013-07-04 03:24:09 +0900 |
commit | 2ef085d0e6960f5087c97266a7211d37ddaa9f68 (patch) | |
tree | 7edac95cbc3bbe0aea721e95e8d4804486a7d0ea /contrib/pg_upgrade/info.c | |
parent | f71939cd1ac765ba618115f40de4d9c47955a9ef (diff) | |
download | postgresql-2ef085d0e6960f5087c97266a7211d37ddaa9f68.tar.gz postgresql-2ef085d0e6960f5087c97266a7211d37ddaa9f68.zip |
Get rid of pg_class.reltoastidxid.
Treat TOAST index just the same as normal one and get the OID
of TOAST index from pg_index but not pg_class.reltoastidxid.
This change allows us to handle multiple TOAST indexes, and
which is required infrastructure for upcoming
REINDEX CONCURRENTLY feature.
Patch by Michael Paquier, reviewed by Andres Freund and me.
Diffstat (limited to 'contrib/pg_upgrade/info.c')
-rw-r--r-- | contrib/pg_upgrade/info.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/contrib/pg_upgrade/info.c b/contrib/pg_upgrade/info.c index c381f112f14..18daf1c32f7 100644 --- a/contrib/pg_upgrade/info.c +++ b/contrib/pg_upgrade/info.c @@ -321,12 +321,19 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo) "INSERT INTO info_rels " "SELECT reltoastrelid " "FROM info_rels i JOIN pg_catalog.pg_class c " - " ON i.reloid = c.oid")); + " ON i.reloid = c.oid " + " AND c.reltoastrelid != %u", InvalidOid)); PQclear(executeQueryOrDie(conn, "INSERT INTO info_rels " - "SELECT reltoastidxid " - "FROM info_rels i JOIN pg_catalog.pg_class c " - " ON i.reloid = c.oid")); + "SELECT indexrelid " + "FROM pg_index " + "WHERE indisvalid " + " AND indrelid IN (SELECT reltoastrelid " + " FROM info_rels i " + " JOIN pg_catalog.pg_class c " + " ON i.reloid = c.oid " + " AND c.reltoastrelid != %u)", + InvalidOid)); snprintf(query, sizeof(query), "SELECT c.oid, n.nspname, c.relname, " |