diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 8b14b96..c12bf6c 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -2332,6 +2332,9 @@ reindex_index(Oid indexId) * If the index is marked invalid or not ready (ie, it's from a failed * CREATE INDEX CONCURRENTLY), we can now mark it valid. This allows * REINDEX to be used to clean up in such cases. + * + * Also if the index was originally built using CREATE INDEX CONCURRENTLY + * we want to clear the indcheckxmin field since it's no longer relevant. */ pg_index = heap_open(IndexRelationId, RowExclusiveLock); @@ -2342,10 +2345,11 @@ reindex_index(Oid indexId) elog(ERROR, "cache lookup failed for index %u", indexId); indexForm = (Form_pg_index) GETSTRUCT(indexTuple); - if (!indexForm->indisvalid || !indexForm->indisready) + if (!indexForm->indisvalid || !indexForm->indisready || indexForm->indcheckxmin) { indexForm->indisvalid = true; indexForm->indisready = true; + indexForm->indcheckxmin = false; simple_heap_update(pg_index, &indexTuple->t_self, indexTuple); CatalogUpdateIndexes(pg_index, indexTuple); }