Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails

From: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Tender Wang <tndrwang(at)gmail(dot)com>, Junwang Zhao <zhjwpku(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Alexander Lakhin <exclusion(at)gmail(dot)com>, Baehler Thomas SBB CFF FFS <thomas(dot)baehler2(at)sbb(dot)ch>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails
Date: 2024-09-04 22:57:28
Message-ID: 20240905005728.0836d609@karst
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2 Sep 2024 23:01:47 +0200
Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com> wrote:

[…]

> My proposal was to clean everything related to the old FK and use some
> existing code path to create a fresh and cleaner one. This requires some
> refactoring in existing code, but we would win a common path of code between
> create/attach/detach, a cleaner catalog and easier code maintenance.
>
> I've finally been able to write a PoC that implement this by calling
> addFkRecurseReferenced() from DetachPartitionFinalize(). I can't join
> it here because it is currently an ugly draft and I still have some work
> to do. But I would really like to have a little more time (one or two days)
> to explore this avenue further before you commit yours, if you don't mind?
> Or maybe you already have considered this avenue and rejected it?

Please, find in attachment a patch implementing this idea.

Regards,

Attachment Content-Type Size
v2-0001-Rework-foreign-key-mangling-during-ATTACH-DETACH.patch text/x-patch 26.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-09-04 23:34:21 Re: Use streaming read API in ANALYZE
Previous Message Tom Lane 2024-09-04 22:52:21 Re: Invalid "trailing junk" error message when non-English letters are used