1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

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.
This commit is contained in:
Fujii Masao
2013-07-04 03:24:09 +09:00
parent f71939cd1a
commit 2ef085d0e6
21 changed files with 333 additions and 163 deletions

View File

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