Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j8zgd-0007RG-P7 for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Mar 2020 05:01:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j8zgc-0003Ip-Jf for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Mar 2020 05:01:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j8zga-0003Ii-OC for pgsql-bugs@lists.postgresql.org; Tue, 03 Mar 2020 05:01:42 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j8zgS-0005y3-4H for pgsql-bugs@lists.postgresql.org; Tue, 03 Mar 2020 05:01:40 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 9A8D0621; Tue, 3 Mar 2020 00:01:28 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 03 Mar 2020 00:01:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=AvEGqiZdAny1xwpFNiCLB6BJgCi VWF5xPJnE77cGtTU=; b=ORdoK7iYizl5dThWb/2i268hYh0HpEqeNsl9Bi8RdTm UKDy8dW0xKAV+RxzCm4WAV3G7g/5spQxp7HEqLd5R0NPY4EkGzbpbGFzk5R42pjd sgYFzlhHQ3u4WERICpr3xbMnVFBi7zfk2cm5xG4TK3+8etB0QAC79Em5gSKl/hES sgY+GJ8eDbBALZAbH0vXsMbKIk0jzEsntjb4k0yK9lJCXj9cPzDuFwne7kMDccKJ 4uN77BFw7T4PAZW0bREmADGpM5Sxf0U+L9EKsXDBNZidWLLCE5VnbYCHiYuo/PUo 1vUVUIq7xgoIQv4VMR7p02Kz3XvoxL81Hk1yTYXHlMA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=AvEGqi ZdAny1xwpFNiCLB6BJgCiVWF5xPJnE77cGtTU=; b=QQQxohRK5T+y4xzxPEtHZZ f4fQm4t/Mi1DUTPiLh8nXU7nEhoyfFBxqJ9QBaoJ74FNAzGDrwBJQKXduBMX5XXS FjZwgxXRnW6zDuY7pwMBqVzPoYrihNMpHh4KPvxAJ8jcBEw0M6Oo5R0kt51CFprs EUOWZIC/0koM3UFft11/CEJUKUjKUhjNLbd2aESqZxUr+HtB6FB2KLOGcQUUzYjo jsB8HWTJXKSUG6jBQnu51fhdeMCyixx9FPt7PbIHaAUfSQPvSMmwkxKLkrgWEfLR GMrIlP4gM7nIIHICN9Lv6JIDNIN8bNt3a1lOZaivW73NY/NmytOz3Y4S2FlMq9/A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedruddthedgjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucfkphepudduuddruddtvddrudektddrudekheenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlse hprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 00CE33060FD3; Tue, 3 Mar 2020 00:01:25 -0500 (EST) Date: Tue, 3 Mar 2020 14:01:22 +0900 From: Michael Paquier To: Amit Langote Cc: exclusion@gmail.com, PostgreSQL mailing lists , Alvaro Herrera Subject: Re: BUG #16276: Server crash on an invalid attempt to attach a partition to an index Message-ID: <20200303050122.GG32059@paquier.xyz> References: <16276-5cd1dcc8fb8be7b5@postgresql.org> <20200226080624.GH17153@paquier.xyz> <20200227023120.GC1969@paquier.xyz> <20200227124952.GC403330@paquier.xyz> <20200302033921.GC32059@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oOB74oR0WcNeq9Zb" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --oOB74oR0WcNeq9Zb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Mar 02, 2020 at 07:39:44PM +0900, Amit Langote wrote: > Done, please see attached. Thanks. There are actually some safeguards in ATPrepCmd()@tablecmds.c when calling ATSimplePermissions(). However, as this is checked for both (ATT_TABLE | ATT_PARTITIONED_INDEX) then it would not blow up as ALTER INDEX and ALTER TABLE use the same code path. Using DETACH partition triggers this code path's error though, making the hint added in your patch actually correct. So, applied this stuff down to 11, with test cases on all branches. I have added a test case with ALTER TABLE DETACH PARTITION for an index while on it. As the error is triggered at transformation time which is a tad more generic than the work done in tablecmds.c for each command, I have also removed the error hint and kept the code simpler. -- Michael --oOB74oR0WcNeq9Zb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl5d5KIACgkQnvQgOdby QH203Q/8DoJ7pqf1hfgx7Dm0HuIGOGu7nzr0FqXREltu4RcO23XhXgBso8NyjnRW rUxu9t1q9Gk3QFK5GfE6KcaW+/PdTD2Jh/gvKNyEQVJQ3SDlquD+iJhRnKb2Q3xA yrxmXz7onMO2a76TSTyX4lGzA9iuO23QiR4nSYaF9iYgmUJj2zaiWxoCw6X5i5MX 8uj3g+Wq0QdZ6Y7nFMiq+r0boiJkjRpDx99Fkab4fSdLJ28xBegvSWbYFomVb1ii bZRnWGTQcDcn18JimA3RAFtupKS8CEL97pzZ9euoFvGFfaSWQX9SeqzSTp7Ia2dQ rD5mzN+CvY7h4daxZyZBTycHtQRdFQzhfP1WZ2mylpwjaXn2AeDY64CjuhEolpBR qTpjBvuZDGyyQ8sBLqVz5Ia2wGE3i2IU7NQUnlqiwXFCw/8dYwllLHwKwSOoWBap LRel6SbRpHn5dnK+PoBxFbpALfd57KzhX2cVWFxVhNhb3OfV5wdq8i8yqXohDMy8 RMhwgKE6P8E76lIJ5nicIGtnOixosoSdb6pyLp6SLIn2PZNIa+pI8t79V++NuezN KhcPhV3GVHoF2R1bJQZx9GNUCsMbUZnFM2V4kMoKQUsak0D/MyByB4jdJNBxxPXf bqO8lzwaGO8IshQwnCTVx7y03zAr45Rk3KuCNTklQ3SoZWSworI= =Y5SK -----END PGP SIGNATURE----- --oOB74oR0WcNeq9Zb--