Re: ALTER tbl rewrite loses CLUSTER ON index

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@2ndquadrant.com>, Amit Langote <amitlangote09@gmail.com>, pgsql-hackers@postgresql.org
Date: 2020-03-02T03:28:18Z
Lists: pgsql-hackers
On Sat, Feb 29, 2020 at 10:52:58AM -0600, Justin Pryzby wrote:
> Rebased Amit's patch and included my own 0002 to fix the REINDEX CONCURRENTLY
> issue.

I have looked at 0002 as that concerns me.

> +SELECT indexrelid::regclass FROM pg_index WHERE indrelid='concur_clustered'::regclass;
> +       indexrelid       
> +------------------------
> + concur_clustered_i_idx
> +(1 row)

This test should check after indisclustered.  Except that, the patch
is fine so I'll apply it if there are no objections.
--
Michael

Commits

  1. Refactor cluster.c to use new routine get_index_isclustered()

  2. Preserve clustered index after rewrites with ALTER TABLE

  3. Preserve replica identity index across ALTER TABLE rewrite

  4. Remove RangeIOData->typiofunc

  5. Preserve pg_index.indisclustered across REINDEX CONCURRENTLY