aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2020-03-03 10:12:49 +0900
committerMichael Paquier <michael@paquier.xyz>2020-03-03 10:12:49 +0900
commitf087d63a45b5935b5c15cecb7d88f140d5cc8b7c (patch)
treeda946cd0d358d51d464aa96d929fb95195411160 /src/backend
parent3b5709e664c44c75c1d27a20c59fdbb0dec3ded5 (diff)
downloadpostgresql-f087d63a45b5935b5c15cecb7d88f140d5cc8b7c.tar.gz
postgresql-f087d63a45b5935b5c15cecb7d88f140d5cc8b7c.zip
Preserve pg_index.indisclustered across REINDEX CONCURRENTLY
If the flag value is lost, a CLUSTER query following REINDEX CONCURRENTLY could fail. Non-concurrent REINDEX is already handling this case consistently. Author: Justin Pryzby Discussion: https://postgr.es/m/20200229024202.GH29456@telsasoft.com Backpatch-through: 12
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/catalog/index.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index bb90fd38113..7408d495326 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -1528,7 +1528,13 @@ index_concurrently_swap(Oid newIndexId, Oid oldIndexId, const char *oldName)
newIndexForm->indimmediate = oldIndexForm->indimmediate;
oldIndexForm->indimmediate = true;
- /* Mark old index as valid and new as invalid as index_set_state_flags */
+ /* Preserve indisclustered in the new index */
+ newIndexForm->indisclustered = oldIndexForm->indisclustered;
+
+ /*
+ * Mark the old index as valid, and the new index as invalid similarly
+ * to what index_set_state_flags() does.
+ */
newIndexForm->indisvalid = true;
oldIndexForm->indisvalid = false;
oldIndexForm->indisclustered = false;