Re: BUG #17997: Assert failed in validatePartitionedIndex() when attaching partition index to child of valid index

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17997: Assert failed in validatePartitionedIndex() when attaching partition index to child of valid index
Date: 2023-06-27 11:00:00
Message-ID: 14987634-43c0-0cb3-e075-94d423607e08@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

26.06.2023 11:05, Michael Paquier wrote:
> A third solution that came into my mind just now would be to revisit
> the choice done in AttachPartitionEnsureIndexes() where an invalid
> index can be chosen as a match when creating the indexes on the
> partitions, so as we are able to get to the bottom of a chain with
> valid indexes for the whole tree. I have been testing the attached
> and it has been working here the way I'd expect when manipulating
> partition trees with ATTACH PARTITION, though this breaks the scenario
> of this bug report because we would now get a failure when attempting
> to attach an index in the last command.

Thanks for the fix!

This solution seems sensible to me. The only downside I see is that an
invalid index would be left orphaned after ATTACH PARTITION, but I couldn't
find in doc/ or src/test/regress/ any promises that such index must be
used. I also don't see a way to make a previously valid index inside the
partition index tree invalid and available to attaching a child index to it
in the same time.

Beside that, maybe it would be better to place the test for the fix in
indexing.sql, where many similar operations with partitioned indexes are
performed.

Best regards,
Alexander

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2023-06-27 11:03:16 BUG #18002: Duplicate entries of row possible even after having primary key
Previous Message Michael Paquier 2023-06-27 06:33:30 Re: BUG #18000: Access method used by matview can be dropped leaving broken matview