Preserve clustered index after rewrites with ALTER TABLE
authorMichael Paquier
Mon, 6 Apr 2020 02:05:47 +0000 (11:05 +0900)
committerMichael Paquier
Mon, 6 Apr 2020 02:05:47 +0000 (11:05 +0900)
commit3e62dd3a937b7da84e8ae126c7bf8319c1cd5c08
tree0fb58513c69a4d565fc98de55095c0c8b0b59c4e
parent23a0cf2c9ff0c59b01dc401f870130578f4213fa
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[email protected]
Backpatch-through: 9.5
src/backend/commands/tablecmds.c
src/backend/utils/cache/lsyscache.c
src/include/utils/lsyscache.h
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql