public inbox for [email protected]  
help / color / mirror / Atom feed
From: Amul Sul <[email protected]>
To: Sami Imseih <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Bug in detaching a partition with a foreign key.
Date: Mon, 20 Jan 2025 12:11:18 +0530
Message-ID: <CAAJ_b96gbP0CU+VaXC_cPOB0zDXd+ygOac_9r8PVPej8gA+cYA@mail.gmail.com> (raw)
In-Reply-To: <CAA5RZ0vk4SJ9PiD2RyG-CKOYvOFewz6QweKcp2_EegBKns=dOA@mail.gmail.com>
References: <CAAJ_b97GuPh6wQPbxQS-Zpy16Oh+0aMv-w64QcGrLhCOZZ6p+g@mail.gmail.com>
	<CAA5RZ0vk4SJ9PiD2RyG-CKOYvOFewz6QweKcp2_EegBKns=dOA@mail.gmail.com>

On Sat, Jan 18, 2025 at 2:14 AM Sami Imseih <[email protected]> wrote:
>
> This is a bug indeed. I tried your patch, but it ends up in a seg fault.
>
> [...]
> If the relation on the parent and child constraint match, that
> tells us we don't have inheritance.
> So, I am thinking we should add another condition for checking
> if a foreign key is inherited by checking if the parent constraint
> relation is different from the child constraint relation.
>
> I am attaching an unpolished patch ( we need test coverage as well ) that
> implements  the above. All tests pass with this patch.

Thanks for confirming the bug. TBH, I haven't had a chance to look into the
issue in detail yet, but my understanding of the detach operation is that it
should cut the link between the parent constraint and the constraint on
the partition being detached. The trial patch I posted was meant to prevent
cutting the link between the partition's constraint and the constraint that
inherits it.  Your patch seems to achieve the same, AFAIUC, but I'm not sure I
like the way it's doing, nor the trial patch I posted. A crash is certainly
possible with that patch, but it would be helpful if you could provide more
context -- such as crash detail and/or a test case.

Regards,
Amul






view thread (4+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Bug in detaching a partition with a foreign key.
  In-Reply-To: <CAAJ_b96gbP0CU+VaXC_cPOB0zDXd+ygOac_9r8PVPej8gA+cYA@mail.gmail.com>

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

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