Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahash partition table - Mailing list pgsql-bugs

From ocean_li_996
Subject Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahash partition table
Date
Msg-id 5ca9d8f4.65cd.199d24b5fa6.Coremail.ocean_li_996@163.com
Whole thread Raw
In response to Re:Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahash partition table  ("songjinzhou" <tsinghualucky912@foxmail.com>)
Responses Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahashpartition table
List pgsql-bugs
Hello jinzhou,

Thanks for your opinion.

At 2025-10-11 10:00:54, "songjinzhou" <tsinghualucky912@foxmail.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

pgsql-bugs by date:

Previous
From: "songjinzhou"
Date:
Subject: Re:Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahash partition table
Next
From: "songjinzhou"
Date:
Subject: Re: BUG #19070: issue with DETACH PARTITION CONCURRENTLY on ahashpartition table