Improve some error messages with invalid indexes for REINDEX CONCURRENTLY
authorMichael Paquier <michael@paquier.xyz>
Thu, 7 Dec 2023 05:27:54 +0000 (14:27 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 7 Dec 2023 05:27:54 +0000 (14:27 +0900)
commitd43bd090a8fee81fe88eb1e9e15e30d30ee130ed
tree1dc804aaa03c8313484cbe5b72a6fa1a0ba97b2e
parent0bf62460bb9e86101d24e31e915c2e8922675296
Improve some error messages with invalid indexes for REINDEX CONCURRENTLY

An invalid index is skipped when doing REINDEX CONCURRENTLY at table
level, with INDEX_CORRUPTED used as errcode.  This is confusing,
because an invalid index could exist after an interruption.  The errcode
is switched to OBJECT_NOT_IN_PREREQUISITE_STATE instead, as per a
suggestion from Andres Freund.

While on it, the error messages are reworded, and a hint is added,
telling how to rebuild an invalid index in this case.  This has been
suggested by Noah Misch.

Discussion: https://postgr.es/m/20231118230958.4fm3fhk4ypshxopa@awork3.anarazel.de
src/backend/commands/indexcmds.c
src/test/regress/expected/create_index.out