Preserve clustered index after rewrites with ALTER TABLE

Michael Paquier <michael@paquier.xyz>

Commit: 41faafbd75a5c70fa94bf57e408e6b29c4425ceb
Author: Michael Paquier <michael@paquier.xyz>
Date: 2020-04-06T02:05:54Z
Releases: 11.8
Preserve clustered index after rewrites with ALTER TABLE

A table rewritten by ALTER TABLE would lose tracking of an index usable
for CLUSTER.  This setting is tracked by pg_index.indisclustered and is
controlled by ALTER TABLE, so some extra work was needed to restore it
properly.  Note that ALTER TABLE only marks the index that can be used
for clustering, and does not do the actual operation.

Author: Amit Langote, Justin Pryzby
Reviewed-by: Ibrar Ahmed, Michael Paquier
Discussion: https://postgr.es/m/20200202161718.GI13621@telsasoft.com
Backpatch-through: 9.5

Files

Discussion