pgsql: Preserve clustered index after rewrites with ALTER TABLE

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Preserve clustered index after rewrites with ALTER TABLE
Date: 2020-04-06 02:08:55
Message-ID: E1jLHC3-0002ct-Js@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cef2b8d52c59168bf34c22bff0ed98fea7232981

Modified Files
--------------
src/backend/commands/tablecmds.c | 46 +++++++++++++++++++++++++++++
src/backend/utils/cache/lsyscache.c | 23 +++++++++++++++
src/include/utils/lsyscache.h | 1 +
src/test/regress/expected/alter_table.out | 48 +++++++++++++++++++++++++++++++
src/test/regress/sql/alter_table.sql | 25 ++++++++++++++++
5 files changed, 143 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2020-04-06 02:42:08 pgsql: Add the option to report WAL usage in EXPLAIN and auto_explain.
Previous Message Andres Freund 2020-04-06 01:52:07 pgsql: Recompute stack base in forked postmaster children.