Re: BUG #18171: Dropping an index on a partitioned table drops all child indices even with a restrict - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #18171: Dropping an index on a partitioned table drops all child indices even with a restrict
Date
Msg-id CAKFQuwb03xQAouCzHC+NpzVngHe9Usu50d0QHFUA2L-d5W5ndA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18171: Dropping an index on a partitioned table drops all child indices even with a restrict  (Nicholas Dujay <nickdujay@gmail.com>)
List pgsql-bugs
On Thu, Oct 26, 2023 at 9:17 AM Nicholas Dujay <nickdujay@gmail.com> wrote:
I first observed this on a production system running 15.3. I've re-run the tests on 15.4 locally and produced the same result.

I realize in my original email that I didn't put restrict, so I've added restrict and confirmed that the child indices are dropped.

postgres=# drop index parent_id_index restrict;
DROP INDEX

Would you consider this an unimplemented feature then, instead of a bug? If so, i'll repost in general.

I'd consider the subject line a bug, but probably at the documentation level, not the code.

Reading the CREATE INDEX notes for partitioned tables it is clear that the index created on the partitioned table is a single entity in the eyes of the system.  That it requires multiple objects to exist is an implementation detail exposed during creation (i.e., the ONLY clause resulting in an invalid index) but not during deletion.

DROP INDEX should have a Notes section where it makes this point explicitly - namely while the children "depend" on the parent the type of dependence is not the kind that is considered when evaluating RESTRICT.

In short, you do seem to have a specific complaint regarding the usability of the system as is that belongs in -general.  I would focus on the problems the current behavior causes when you use the system as designed and see what others suggest regarding workarounds or planned improvements or whatnot.

David J.

pgsql-bugs by date:

Previous
From: Nicholas Dujay
Date:
Subject: Re: BUG #18171: Dropping an index on a partitioned table drops all child indices even with a restrict
Next
From: Tom Lane
Date:
Subject: Re: BUG #18170: Unexpected error: no relation entry for relid 3