Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t3Fn6-00BUIs-In for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Oct 2024 14:23:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t3Fn4-00HaFf-RD for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Oct 2024 14:23:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t3Fn4-00HaFW-7y for pgsql-hackers@lists.postgresql.org; Tue, 22 Oct 2024 14:23:18 +0000 Received: from mail1.dalibo.net ([51.159.93.128] helo=mail.dalibo.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t3Fn2-002P3m-4s for pgsql-hackers@postgresql.org; Tue, 22 Oct 2024 14:23:18 +0000 Received: from karst (82-65-23-130.subs.proxad.net [82.65.23.130]) by mail.dalibo.com (Postfix) with ESMTPSA id CD92527C0D; Tue, 22 Oct 2024 16:23:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1729606994; bh=3gNFj7TuAh482E9weyhRT48Sv6a91+IYAoovf0qXNqg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Y51iqgf8GS0W8cbkBO+2Y0Ihm0tBMLp89hIzl+L7rNIAQ20ohYWfesQAXB2Gu4yx3 GIkhIaBVIkYy/pYcF4MsDARGmWtZJHq2MZGkBPmeqGocIKOass9lSM6NLxoTSTt9xr 35q6pElWoF+3JzcrGWBgM+fB6K6wGh2VRrLgbcNo= Date: Tue, 22 Oct 2024 16:23:12 +0200 From: Jehan-Guillaume de Rorthais To: Alvaro Herrera Cc: Tender Wang , Junwang Zhao , "pgsql-hackers@postgresql.org" , Alexander Lakhin , Guillaume Lelarge , Michael Paquier Subject: Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails Message-ID: <20241022162312.63021cc6@karst> In-Reply-To: <202410181450.xchtzcq2uyjt@alvherre.pgsql> References: <20240926104835.07ae9ab5@karst> <202410181450.xchtzcq2uyjt@alvherre.pgsql> Organization: Dalibo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 18 Oct 2024 16:50:59 +0200 Alvaro Herrera wrote: > On 2024-Sep-26, Jehan-Guillaume de Rorthais wrote: >=20 > > REL_14_STABLE backport doesn't seem trivial, so I'll wait for some > > feedback, review & decision before going further down in backpatching. >=20 > Hi, thanks for these patches. I have made some edits of my own. In the > end I decided that I quite liked the new structure of the > addFkConstraint() function and friends.=20 Yes, I especially like the fact that addFkRecurseReferencing() and addFkRecurseReferenced() have now the same logic/behavior. > I added a bunch of comments and changed names somewhat. checked. > Also, I think the benefit of the refactoring is > more obvious when all patches are squashed together, so I did that. OK. > For branch 14, I opted to make it delete the constraints on detach. > This isn't ideal but unless somebody wants to spend a lot more time on > this, it seems the best we can do. Leaving broken constraints around > seems worse.=20 Keep that in mind, and move ahead to the next level: self-FK on partitioned table! ;-) https://www.postgresql.org/message-id/flat/20230707175859.17c91538%40karst#= 0dc7b8afd8b780899021bbb075598250 > [=E2=80=A6] >=20 > I spent some time going through your test additions and ended up with > your functions in this form: > [=E2=80=A6] >=20 > However, in the end I think this is a very good technique to verify that > the fix works correctly, but it's excessive to include these results in > the tests forevermore. So I've left them out for now. Maybe we should > reconsider on the older branches? The point here was to make sure futur work/refactoring don't forget/break anything in the catalog representation of FK on partitions. Regards,