diff options
-rw-r--r-- | src/backend/catalog/index.c | 8 | ||||
-rw-r--r-- | src/backend/utils/cache/relcache.c | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index ed30b09b42a..403e9ab5f25 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.292 2008/01/30 19:46:48 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.292.2.1 2008/08/10 19:02:46 tgl Exp $ * * * INTERFACE ROUTINES @@ -2373,9 +2373,13 @@ reindex_relation(Oid relid, bool toast_too) * problem. */ is_pg_class = (RelationGetRelid(rel) == RelationRelationId); - doneIndexes = NIL; + + /* Ensure rd_indexattr is valid; see comments for RelationSetIndexList */ + if (is_pg_class) + (void) RelationGetIndexAttrBitmap(rel); /* Reindex all the indexes. */ + doneIndexes = NIL; foreach(indexId, indexIds) { Oid indexOid = lfirst_oid(indexId); diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index ec0ba854cf6..73d7d8ef1ed 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.266.2.3 2008/04/16 18:23:12 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.266.2.4 2008/08/10 19:02:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2994,6 +2994,13 @@ insert_ordered_oid(List *list, Oid datum) * messages. In practice it is only used on pg_class (see REINDEX). * * It is up to the caller to make sure the given list is correctly ordered. + * + * We deliberately do not change rd_indexattr here: even when operating + * with a temporary partial index list, HOT-update decisions must be made + * correctly with respect to the full index set. It is up to the caller + * to ensure that a correct rd_indexattr set has been cached before first + * calling RelationSetIndexList; else a subsequent inquiry might cause a + * wrong rd_indexattr set to get computed and cached. */ void RelationSetIndexList(Relation relation, List *indexIds, Oid oidIndex) @@ -3012,7 +3019,6 @@ RelationSetIndexList(Relation relation, List *indexIds, Oid oidIndex) relation->rd_indexvalid = 2; /* mark list as forced */ /* must flag that we have a forced index list */ need_eoxact_work = true; - /* we deliberately do not change rd_indexattr */ } /* |