Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmQIg-0002q0-8i for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Dec 2020 23:52:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kmQIe-0006Vk-SZ for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Dec 2020 23:52:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmQIe-0006Vc-M3 for pgsql-bugs@lists.postgresql.org; Mon, 07 Dec 2020 23:52:12 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmQIc-0000WY-GJ for pgsql-bugs@lists.postgresql.org; Mon, 07 Dec 2020 23:52:11 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 8028F5C023D; Mon, 7 Dec 2020 18:52:09 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 07 Dec 2020 18:52:09 -0500 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:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=P3JNgIpNi5KsECtuQ vBrSefdPWfN+gqHZ8E+9qP86DE=; b=V4URycACX3MMgvCI3tgB5SrVR1x3XsthH KBQ2SP5/iHipDnqF+HHXCcyXalWEriXWIg1NfwtYC0tahWSI1KJREmUi86gBxK15 DyIkj6iyNuZOo2Xtueq8/JTp1hxjmq3pQWFD6j30k/CEx93I0YqxhPM2tLmekdHj D2ZJrBZAiBO9Y1WbbZxrnhe6Ijc178gDckD9MtfGSccAho5hsGXWrKoGdLQ//Cpm nMgbOrQ2tou+kW/mqSPVcpeGF7FOTE6IOJc8JxiuKplWwq5yBQmP8S96n7mfhwUB vdbh9Forh3KJedh57fSw6OcNPhBgAiYaOscETwVGOa9QRRAtrcUjg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudejhedgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtuggjfgesthdtre dttdervdenucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgv segrlhhvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvefgleevgeeuje eghfegteeghfegheeifeehheelteetieduieeihffggfehffetnecukfhppeduledtrdel hedrudekrdejleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.18.79]) by mail.messagingengine.com (Postfix) with ESMTPA id 7D443240057; Mon, 7 Dec 2020 18:52:08 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 4BA772A154D; Mon, 7 Dec 2020 20:52:06 -0300 (-03) Date: Mon, 7 Dec 2020 20:52:06 -0300 From: Alvaro Herrera To: Tom Lane Cc: pgsql-bugs@lists.postgresql.org Subject: Re: ALTER CONSTRAINT on a partitioned FK isn't working Message-ID: <20201207235206.GA2277@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201207233414.GA24167@alvherre.pgsql> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Dec-07, Alvaro Herrera wrote: > Yeah, this query shows that the tgdeferrable and tginitdeferred columns > ought to be dropped: > > select tgname, tgdeferrable, tginitdeferred from pg_trigger; Sorry, I meant "ought to be updated". But there's more to it than that: the pg_constraint entries themselves are not updated, and that's because ALTER CONSTRAINT does not have recurse at all. So the first thing to do is add an "ATSimpleRecursion()" call for the appropriate case, but even that is not sufficient, as we need to recurse on the referenced side also, not just the referencing side -- and that's a tad more involved. (ATExecAlterConstraint is explicitly not handling the case.)