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 1t4FiY-00HBAm-PX for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Oct 2024 08:30:46 +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 1t4FiW-00EJeb-RR for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Oct 2024 08:30:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t4FiW-00EJeS-Fk for pgsql-hackers@lists.postgresql.org; Fri, 25 Oct 2024 08:30:44 +0000 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t4FiT-002lLG-Vb for pgsql-hackers@postgresql.org; Fri, 25 Oct 2024 08:30:43 +0000 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id A235611401BD; Fri, 25 Oct 2024 04:30:40 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Fri, 25 Oct 2024 04:30:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1729845040; x= 1729931440; bh=SggJh+B6nb/yiZ4JWRL/OX+yIDLmGwuAhYI1PVjpq00=; b=X o4nGJiAC34edmoYei8jUXll633xfOV8gzsIHDrfbiB73kH+qr4nPefGNc8LjHVkW QG4nPuu9Hex3FOkZfTtk+/VBLMzbH0gLYr0Lb4yTDpxFxQbZm81Ffwt0rj7XoiyY vunhZBsgQD4U/oaC9G9Reyb/GIq+wSaaDKfAW9HeFOyAJyV3EvVtpsDng7mALPzC CbbIh42OTvWTqP+uUFnxz0Vuta6hOSuE7N0mcR1JBQedr9yN68yqF3FM9yUMh3ND Rh3A+lj+yl3SXxblWDFIZvRGSCTxFkHcaIdbTRtdHWJxqeRLUxySBtIe+qfqq4mG GUGdodbkfPJuGY3dKJgAw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdejvddgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeen ucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhh drnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffh jeejhffgieeuueekjeekfffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrph hrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsggprh gtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjghgurhesuggr lhhisghordgtohhmpdhrtghpthhtohepvgigtghluhhsihhonhesghhmrghilhdrtghomh dprhgtphhtthhopehtnhgurhifrghnghesghhmrghilhdrtghomhdprhgtphhtthhopehg uhhilhhlrghumhgvsehlvghlrghrghgvrdhinhhfohdprhgtphhtthhopehpghhsqhhlqd hhrggtkhgvrhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 25 Oct 2024 04:30:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1729845033; bh=5wzdsyFTaIZc6ZUHvdsNsCvsQKTc+DYzjNqUKGeBWXs=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=CG6b88NM8MEiOkVWKtEEBBKm9bRk2eRZVvshoE2J2hAyoT9CPxETx1uHeifoyVLw8 M4J8blI16z0kj95/rxHJQGSTsBJA1eEfTykAybQMP/m+KRw5qo1XioF/hKebgd+MmL kVi8PTTuP/OVEylPPVCZ29gsHSYVmgPGH21u0uX1sldzpHZSowVFutg/hbJ/czuKoP 8WwAVx2U9OYj1mzTEsIBLYAHSUDKGXvnFiHdlS2vUvuUi0cpQ/bo9L6Ttzvgai9wRH hUj7h8mEoFlH7EwrYfiTrWGBbBe3TGkovAKtEQ8yKpa7/ruAFdiAIcrFcq8qUXCOWw McFnWfksEUmtg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id D486C8B; Fri, 25 Oct 2024 10:30:33 +0200 (CEST) Date: Fri, 25 Oct 2024 10:30:33 +0200 From: Alvaro Herrera To: Tender Wang Cc: Alexander Lakhin , Jehan-Guillaume de Rorthais , "pgsql-hackers@postgresql.org" , Guillaume Lelarge Subject: Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails Message-ID: <202410250830.puisbzuy4yyj@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Oct-25, Tender Wang wrote: > Thanks for reporting. I can reproduce this memory invalid access on HEAD. > After debuging codes, I found the root cause. > In DetachPartitionFinalize(), below code: > att = TupleDescAttr(RelationGetDescr(partRel), > attmap->attnums[conkey[i] - 1] - 1); > > We should use confkey[i] -1 not conkey[i] - 1; Wow, how embarrasing, now that's one _really_ stupid bug and it's totally my own. Thanks for the analysis! I'll get this patched soon. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/