From: | Amul Sul <sulamul(at)gmail(dot)com> |
---|---|
To: | Sami Imseih <samimseih(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in detaching a partition with a foreign key. |
Date: | 2025-01-20 06:41:18 |
Message-ID: | CAAJ_b96gbP0CU+VaXC_cPOB0zDXd+ygOac_9r8PVPej8gA+cYA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Jan 18, 2025 at 2:14 AM Sami Imseih <samimseih(at)gmail(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Shubham Khanna | 2025-01-20 06:49:41 | Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility. |
Previous Message | Michael Paquier | 2025-01-20 06:34:41 | Re: per backend I/O statistics |