Rework handling of invalid indexes with REINDEX CONCURRENTLY

Enterprise / PostgreSQL - Michael Paquier [] - 17 April 2019 00:33 EDT

Per discussion with others, allowing REINDEX INDEX CONCURRENTLY to work for invalid indexes when working directly on them can have a lot of
value to unlock situations with invalid indexes without having to use a dance involving DROP INDEX followed by an extra CREATE INDEX CONCURRENTLY (which would not work for indexes with constraint dependency anyway). This also does not create extra bloat on the relation involved as this works on individual indexes, so let's enable it.

Note that REINDEX TABLE CONCURRENTLY still bypasses invalid indexes as we don't want to bloat the number of indexes defined on a relation in the event of multiple and successive failures of REINDEX CONCURRENTLY.

More regression tests are added to cover those behaviors, using an invalid index created with CREATE INDEX CONCURRENTLY.

a6dcf9df4d Rework handling of invalid indexes with REINDEX CONCURRENTLY
doc/src/sgml/ref/create_index.sgml | 6 ++--
doc/src/sgml/ref/reindex.sgml | 11 ++++---
src/backend/commands/indexcmds.c | 29 ++++--------------
src/test/regress/expected/create_index.out | 47 ++++++++++++++++++++++++++++++
src/test/regress/sql/create_index.sql | 20 +++++++++++++
5 files changed, 80 insertions(+), 33 deletions(-)


  • Share