Re: [PATCH] Fix: Partitioned parent index remains invalid after child indexes are repaired

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Haibo Yan <tristan(dot)yim(at)gmail(dot)com>, Mohamed ALi <moali(dot)pg(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix: Partitioned parent index remains invalid after child indexes are repaired
Date: 2026-04-14 16:05:38
Message-ID: ad5l0sGiJwdkXI-L@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 14, 2026 at 07:18:33AM +0900, Michael Paquier wrote:
> On Sat, Apr 11, 2026 at 11:10:54AM -0500, Sami Imseih wrote:
>> Would the right solution here be to try to have the ATTACH PARTITION check if
>> the parent index is not valid, then validatePartitionedIndex() ?
>
> This may be a backpatchable thing, even if it requires one to detach
> one partition before attaching it again, or attach a fake partition to
> force a flip of the flag, before detaching this fake partition.

Actually no. Yesterday I was looking at that from the angle of using
ALTER TABLE for the job, that requires a partition bound. Sami has
mentioned me that a repeated ALTER INDEX .. ATTACH PARTITION does not
fail when repeated, so we could just rely on that and enforce a
round of indisvalid across the partitioned index we are working on.

Could you write a patch? It would be better to have tests with
multiple levels, at least, with a partitioned table being a leaf of
another partitioned table. I am sure you get the picture, the point
being to recurse across multiple levels.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2026-04-14 16:08:04 Re: GetCachedPlan() refactor: move execution lock acquisition out
Previous Message Florents Tselai 2026-04-14 15:32:47 Re: ISBN range table