pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: feichanghong <feichanghong@qq.com>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Cc: alvherre <alvherre@alvh.no-ip.org>
Subject: Re: BUG #18371: There are wrong constraint residues when detach hash partiton concurrently
Date: Tue, 5 Mar 2024 12:13:08 +0900
Message-ID: <ZeaNxNW4m2106fSk@paquier.xyz> (raw)
In-Reply-To: <tencent_4DA59E77900C87CEBA0F0213000E64040D07@qq.com>
References: <18371-7fef49f63de13f02@postgresql.org>
	<tencent_4DA59E77900C87CEBA0F0213000E64040D07@qq.com>

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

Attachments:

  [application/pgp-signature] signature.asc (832B, ../ZeaNxNW4m2106fSk@paquier.xyz/2-signature.asc)
  download

view thread (11+ messages)  latest in thread

Message-ID: <ZeaNxNW4m2106fSk@paquier.xyz>
Permalink:  ../ZeaNxNW4m2106fSk@paquier.xyz/
Also on:    postgresql.org/message-id/ZeaNxNW4m2106fSk@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, feichanghong@qq.com, pgsql-bugs@lists.postgresql.org, alvherre@alvh.no-ip.org
  Subject: Re: BUG #18371: There are wrong constraint residues when detach hash partiton concurrently
  In-Reply-To: <ZeaNxNW4m2106fSk@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox