Hi Alexandra,

Thanks for the patch. With v1, the child index silently loses its
CLUSTER ON or REPLICA IDENTITY setting. With your test extension:

  CREATE EXTENSION test_extension;
  CREATE TABLE foo_part PARTITION OF part
    FOR VALUES FROM ('2023-01-01') TO ('2023-02-01');
  ALTER TABLE foo_part CLUSTER ON foo_part_id_date_idx;

After dump and restore, indisclustered of foo_part_id_date_idx is
false. dumpIndex() puts ALTER TABLE ... CLUSTER ON and REPLICA
IDENTITY in the same entry as CREATE INDEX.

I think the ordering you suggest is the better fix. ATTACH PARTITION
reuses a matching index that already exists, so the child index keeps
its name and settings. That would also fix the renamed index case.

Thanks,
Shihao

Reply via email to