Re: BUG #18371: There are wrong constraint residues when detach hash partiton concurrently

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: BUG #18371: There are wrong constraint residues when detach hash partiton concurrently
Дата
Msg-id ZeaNxNW4m2106fSk@paquier.xyz
обсуждение исходный текст
Ответ на Re:BUG #18371: There are wrong constraint residues when detach hash partiton concurrently  ("feichanghong" <feichanghong@qq.com>)
Ответы Re: BUG #18371: There are wrong constraint residues when detach hash partiton concurrently  (alvherre <alvherre@alvh.no-ip.org>)
Re: BUG #18371: There are wrong constraint residues when detach hash partiton concurrently  (费长红 <feichanghong@qq.com>)
Список pgsql-bugs
On Thu, Feb 29, 2024 at 02:21:58PM +0800, feichanghong wrote:
> What I said here is wrong, the constraints on the hash partition will also take
> effect. But this constraint depends on the oid of the parent partition.

Something is weird with the format of the messages you have sent, by
the way.

> Based on the analysis above, should the added constraint for a hash partition
> be dropped after detachment?I have initially implemented this logic
> in the attached patch and added a testcase. I really hope that
> developers can give me some suggestions.

I am not much a fan of relying on ATExecDropConstraint(), where the
logic introduced is a copy-paste of get_constraint_name() to retrieve
the name of the constraint to drop.  If any, we ought to rely more on
dropconstraint_internal() instead using the pg_constraint tuple based
on the OID of the constraint, and not do a cross-operation with the
constraint name.

But actually, why do you do a drop of the constraint at all?
DetachAddConstraintIfNeeded() re-adds the constraint as it is, so
instead of re-adding it as-is and then dropping it again, wouldn't it
be better to just *not* re-add to begin with it if we don't need it at
all?

This reproduces down to 14, for what I am assuming is an issue
introduced around 7b357cc6ae55.  Alvaro, what do you think?
--
Michael

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Richard Guo
Дата:
Сообщение: Re: BUG #18375: requested statistics kind "f" is not yet built for statistics object 16722
Следующее
От: David Rowley
Дата:
Сообщение: Re: BUG #18375: requested statistics kind "f" is not yet built for statistics object 16722