Re: BUG #18500: Detaching a partition with an index manually attached to the parent's index triggers Assert
От | Alvaro Herrera |
---|---|
Тема | Re: BUG #18500: Detaching a partition with an index manually attached to the parent's index triggers Assert |
Дата | |
Msg-id | 202406281127.piekjwgnulgf@alvherre.pgsql обсуждение исходный текст |
Ответ на | Re: BUG #18500: Detaching a partition with an index manually attached to the parent's index triggers Assert (Tender Wang <tndrwang@gmail.com>) |
Ответы |
Re: BUG #18500: Detaching a partition with an index manually attached to the parent's index triggers Assert
Re: BUG #18500: Detaching a partition with an index manually attached to the parent's index triggers Assert |
Список | pgsql-bugs |
On 2024-Jun-12, Tender Wang wrote: > I think what you said above. I feel that we need that "tp_pkey" is a > partition > of the partitioned index "t_a_idx". For example, below statement: > > test=# alter table tp drop constraint tp_pkey; > ERROR: cannot drop index tp_pkey because index t_a_idx requires it > HINT: You can drop index t_a_idx instead. > > If "tp_pkey" is not a partition of "t_a_idx", the primary key "tp_pkey" can > be dropped. I guess you could also fix this by adding a PK constraint to the parent table, so that the situation is consistent in the other direction. Here's a proposed patch for master only. It turns all three situations being reported into ereport(ERROR); in one case I have an XXX comment, because we have an alternative when attaching a partition that already has a PK to a partitioned table that has a non-PK index: just create a separate index in the partition. But that would cause slowness, which is probably undesirable. I'm inclined to just remove the XXX comment, but if anyone has other thoughts, they are welcome. I add an errhint() to one of these new errors, but I'm undecided about that idea --- should we add errhint() to all three messages, or none? We can't do this in back branches, of course (incl. 17 at this point), because that might break existing applications, which means we need to adjust behavior in some other way, probably similar to what Tender Wang suggested, namely just don't crash on detach, or something like that. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
Вложения
В списке pgsql-bugs по дате отправления: