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

From: 费长红 <feichanghong(at)qq(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, alvherre <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: BUG #18371: There are wrong constraint residues when detach hash partiton concurrently
Date: 2024-03-05 08:57:18
Message-ID: tencent_B900104494F6DE9533FC3BD13EF24C403809@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2024/3/5, 11:13, "Michael Paquier" <michael(at)paquier(dot)xyz> wrote:
Something is weird with the format of the messages you have sent, by
the way.

Ah ha! This should be a problem with my email client, I will try another client.

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?

After verification, the partition constraints on the partition being detached
remain in effect until the second transaction committed. This newly added
constraint should only be for the purpose of speeding up the re-attach
operation. Perhaps I've missed something?

So, for hash partitioning, it should be better not to re-add new constraints.
Perhaps we should filter out hash partitions in DetachAddConstraintIfNeeded().

--
Best Regards,
Fei Changhong
Alibaba Cloud Computing Ltd.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2024-03-05 09:24:05 RE: Re:BUG #18369: logical decoding core on AssertTXNLsnOrder()
Previous Message Tender Wang 2024-03-05 08:24:59 Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build