Re: pg_dump restore fails for partitions of extension-owned tables

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Aleksandra Pervushina <a(dot)pervushina(at)arenadata(dot)io>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_dump restore fails for partitions of extension-owned tables
Date: 2026-12-03 03:43:05
Message-ID: CAGRkXqQUy+sKA=ys6Lciu+MD21R+e+WEm8WGd5mSer6PXVwW-g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nisha Moond 2026-12-03 03:46:30 Re: DROP SUBSCRIPTION deadlock with ALTER SUBSCRIPTION OWNER TO
Previous Message shihao zhong 2026-12-03 03:07:20 Re: examine_variable ignored CollateExpr