Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahash partition table

From: ocean_li_996 <ocean_li_996(at)163(dot)com>
To: songjinzhou <tsinghualucky912(at)foxmail(dot)com>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, "mohen(dot)lhy(at)alibaba-inc(dot)com" <mohen(dot)lhy(at)alibaba-inc(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, robertmhaas <robertmhaas(at)gmail(dot)com>
Subject: Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahash partition table
Date: 2025-10-11 08:02:59
Message-ID: 5ca9d8f4.65cd.199d24b5fa6.Coremail.ocean_li_996@163.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello jinzhou,

Thanks for your opinion.

At 2025-10-11 10:00:54, "songjinzhou" <tsinghualucky912(at)foxmail(dot)com> wrote:
> Hello hackers, Haiyang. I think the direct deletion of the DetachAddConstraintIfNeeded function in the patch above might not be a
> good idea. Will this create new problems?
>
> Of the two solutions Haiyang mentioned earlier, is the second one more appropriate? Should it be deleted after detaching? For
> example, somewhere in the DetachPartitionFinalize function?

AFAICS, the mainly difference between "Direct deletion of the DetachAddConstraintIfNeeded function" (thought 1)
and "Adding constraint first and removing it later" (thought 2) is the moment after the first transaction commit
of detach concurrently. In that moment, thought 1 will not add a constraint on detached partition and thought 2 will.

However, detached partition still have a partition constraint, which is functionally redundant with the newly added
constraint for a partition table. Regarding the partitioned table, once first transaction has committed, the partition
can be regarded as already detached from its parent. Therefore, I’m inclined to go with thought 1.

--
regards
Haiyang Li

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message songjinzhou 2025-10-11 10:19:32 Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahashpartition table
Previous Message songjinzhou 2025-10-11 02:00:54 Re:Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahash partition table