Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0Ulx-0007i2-VX for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Sep 2018 16:47:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g0Ulw-0007CR-6L for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Sep 2018 16:47:16 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0Ulv-0007CK-S2 for pgsql-hackers@lists.postgresql.org; Thu, 13 Sep 2018 16:47:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0Ult-0007nj-Db for pgsql-hackers@postgresql.org; Thu, 13 Sep 2018 16:47:14 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w8DGl8Yo009522; Thu, 13 Sep 2018 12:47:08 -0400 From: Tom Lane To: Alvaro Herrera cc: Justin Pryzby , Rajkumar Raghuwanshi , pgsql-hackers Subject: Re: cache lookup failed for constraint when alter table referred by partition table In-reply-to: <20180913163504.ecvozcnighb6cbxm@alvherre.pgsql> References: <20180913163504.ecvozcnighb6cbxm@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Thu, 13 Sep 2018 13:35:04 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9520.1536857228.1@sss.pgh.pa.us> Date: Thu, 13 Sep 2018 12:47:08 -0400 Message-ID: <9521.1536857228@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > That's the problem all right. The solution is to drop all > index/constraint objects together in one performMultipleDeletions() > instead of performDeletion() one by one, as in the attached patch. Looks reasonable as far as it goes. Given that we no longer require any of this: - * Now we can drop the existing constraints and indexes --- constraints - * first, since some of them might depend on the indexes. In fact, we - * have to delete FOREIGN KEY constraints before UNIQUE constraints, but - * we already ordered the constraint list to ensure that would happen. can we make any simplifications in earlier steps? At the very least, look for comments related to this assumption. regards, tom lane