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 1sNLki-0087Bf-JP for pgsql-bugs@arkaria.postgresql.org; Sat, 29 Jun 2024 00:15:41 +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 1sNLke-007UFx-V0 for pgsql-bugs@arkaria.postgresql.org; Sat, 29 Jun 2024 00:15:37 +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 1sNLkd-007UFo-MG for pgsql-bugs@lists.postgresql.org; Sat, 29 Jun 2024 00:15:37 +0000 Received: from fhigh1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sNLkW-0044Fl-Pq for pgsql-bugs@lists.postgresql.org; Sat, 29 Jun 2024 00:15:35 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id CB8AF11401FB; Fri, 28 Jun 2024 20:15:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 28 Jun 2024 20:15:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1719620125; x=1719706525; bh=v1wsJlYJbw jf9giE171Ej4/DHQzF2Fjx4TESglMqsWI=; b=AQeT+VP9AHXdxXB4JknMHnkLHU DItkjNo5clrP6NU1/MO5AUWKhMhqeYMBwB7fLQtuZarP7WwVrkAdpL/gqREm1ITf 03/gFHlJLZBet+Lf48KmvXFpsLrNYNyneS+/A8ookhGzTxWSYth1MnitbljoAUbF d3y4EybVRRVQya5mKn9DuZCJ0acB5yOnZQlQsKxtuW1BzM6m6wK+eg3G0dRmPJDo irxTFdRwjDHm/xjaUa0I2AB9oReSdgUP9BJzuHBTkTuiYzpk4KN5u/pLwoyq2P/H IMIQ5YIDGkWPrgKusuhaSvdWH1yyRFm22lqr8PFktBcU+pVbBbRUg7F7LzYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1719620125; x=1719706525; bh=v1wsJlYJbwjf9giE171Ej4/DHQzF 2Fjx4TESglMqsWI=; b=Pqtgeiovqpe6v6wHfAoF2HKOTy0cnjAzRzmNlz8IUL2W wFD4XNz1y2gdMCzSL156WCT4zNA697JVol6ZgBCXZUvp+3cPIjIU4nz+qCnukS9E AlrdYkCnC6CXL+KL7oWi8UiTNXJDwydIdFSSr86qBMpYlWYGors+kFhT0myOVwiE IuqTOHHrTldGu9XLaDD+m4kL1S1VpBnVgAuxwB/fTKZAC9Y8KzODtME74z9KGVTS 6DxA2iJP5ifax42yQdC/eIp393fx/CPCwwUKKcRFQzhBu9zaSLTHPa9qtvN2+SZH frUtEpjRxEACvoUyDLhlv6vu7/mHMDWAKxMZBx/Ijg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtdekgdeffecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeg geffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 28 Jun 2024 20:15:23 -0400 (EDT) Date: Sat, 29 Jun 2024 09:15:09 +0900 From: Michael Paquier To: Alvaro Herrera Cc: Tender Wang , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18500: Detaching a partition with an index manually attached to the parent's index triggers Assert Message-ID: References: <202406281127.piekjwgnulgf@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OIwr9j0nxuMwMBQR" Content-Disposition: inline In-Reply-To: <202406281127.piekjwgnulgf@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --OIwr9j0nxuMwMBQR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jun 28, 2024 at 01:27:17PM +0200, Alvaro Herrera wrote: > I guess you could also fix this by adding a PK constraint to the parent > table, so that the situation is consistent in the other direction. Yes, I've also considered this option when thinking about this thread, but forcing a constraint creation up to the parent felt non-intuitive to me as we force creation of catalog entries on the children based on the state of the parent for basically everything else. So introducing a new path where we would do the reverse is a recipe for more complex code in tablecmds.c, which I'd rather avoid. > Here's a proposed patch for master only. It turns all three situations > being reported into ereport(ERROR); in one case I have an XXX comment, > because we have an alternative when attaching a partition that already > has a PK to a partitioned table that has a non-PK index: just create a > separate index in the partition. But that would cause slowness, which > is probably undesirable. I'm inclined to just remove the XXX comment, > but if anyone has other thoughts, they are welcome. An error sounds saner here in the long term. Tests for all of the code paths involved, perhaps? ;) -- Michael --OIwr9j0nxuMwMBQR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmZ/Ug0ACgkQnvQgOdby QH1ZnA/9EXUlpfuC7A+O0rCa7NIti1DqVigaG3AWk3FU1EcgqFTzT5RLnToejv9l WZzFwKl0kP6lvgzR+Sxo4ZxsZplWoqWubg3vWiY6mPhX5Kh+AV8ybBvySbLLRsax LhBm2NjVPF3h63ZQevPDPHMfWAP9ogv9IGQftSjY3s2AhJj+FnoDP8lW5ip2ylSj 4LIkR7DfQ5/h/Ibi2lxqwEzPE6aUHHqn0qIbZjSdp14fOysCb5eIcyKDxrz/ma1B 2fBri5fnAVQUqJzVtrJkxMOF25NaRd0V66Td8qyXom/C9T3VGCRgdUgWZwh+XoCV BVlTf5lbh1+GUSZBRNJ57ZlYVDfZTEnfBcUPgv+wfVli5misV/0luaNa+ZXWhb3S i+u1Fw9i5Tn/Dq2PBM6lvBqhz/OFauorpD9RXqoDpQyKeAQvhxsqD5JQABqdrU// ZPLeMGZSPUo6e44N5nm0ur5IYBThQsgqF9W/YFBe+GqUaO/Kf3+t1wPVek4qX8wa C1ZtMMxnoJfmsrh62LUdZTxQ6XsN7V5uD42qgcM0i1xZBoRx2hJpVLnc9rlZMwFh pQKNfqfu6x0w2Cl2Kab6WV54zkDG72icpT8kEDf9djT4gEgAU4MQTirlmiHsQJM3 yXG1wJuXCGNgdWtnytp2D5CYnSEv7vbUuRePWzAlrqFQgyhIJoY= =6stp -----END PGP SIGNATURE----- --OIwr9j0nxuMwMBQR--