Re: BUG #18171: Dropping an index on a partitioned table drops all child indices even with a restrict

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Nicholas Dujay <nickdujay(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18171: Dropping an index on a partitioned table drops all child indices even with a restrict
Date: 2023-10-26 16:30:40
Message-ID: CAKFQuwb03xQAouCzHC+NpzVngHe9Usu50d0QHFUA2L-d5W5ndA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Oct 26, 2023 at 9:17 AM Nicholas Dujay <nickdujay(at)gmail(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-10-26 17:12:11 Re: BUG #18170: Unexpected error: no relation entry for relid 3
Previous Message Nicholas Dujay 2023-10-26 16:17:07 Re: BUG #18171: Dropping an index on a partitioned table drops all child indices even with a restrict