If a concurrent REINDEX fails because the table has invalid data, you need to:
-
Fix the invalid data, like it was done here.
-
List the invalid indexes using
SELECT pg_class.relname FROM pg_class, pg_index WHERE pg_index.indisvalid = false AND pg_index.indexrelid = pg_class.oid;
-
Drop each invalid index listed above using
DROP INDEX <indexname>;
-
Try the
REINDEX
again.