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.89) (envelope-from ) id 1gXbDn-0004K6-VK for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Dec 2018 00:20:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gXbDl-0008FB-GF for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Dec 2018 00:20:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXbDk-0008Ew-W4 for pgsql-bugs@lists.postgresql.org; Fri, 14 Dec 2018 00:20:49 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXbDi-0002Wv-Cz for pgsql-bugs@postgresql.org; Fri, 14 Dec 2018 00:20:47 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id ED4A512C5; Thu, 13 Dec 2018 19:20:44 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 13 Dec 2018 19:20:45 -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=fm3; bh=G6BsnBMsEWAmvWmLHLbO504YiHX fB6SWdBiCTHT6qNY=; b=HbnFgZI4WKm967cDcSjhrJzw+IPR8Lwk9gWBwfzqp4n xEuPvDpR00In3KDehfPhMNE1RwWqULaB9H/WEoy4iPRPX0LHQHc8GbHyVmdSms8r lUm8CrFzT82L2Iu3E7Mq3XrC2BVKI5wFUn0BVFK00OtypCUnR87vSOgzzaXFbqDi 4WW8LTxG1zLEG1W4hF9NMeRsTrVWCqLe8lTqUAOuMMdop1wiE63lvBcaI1p6/0lB 3oP1M3M+ix3ONHx7QoFzW9Cisof8TVf6tPcvSwfxnckAQmoVOcpSL6DyUe8qVEZx sbwWHV5iJ2JDJUemvQ9mwJ6UgMUkWUL6DGj0JsPKFCA== 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=fm1; bh=G6BsnB MsEWAmvWmLHLbO504YiHXfB6SWdBiCTHT6qNY=; b=xo6eB/XQkqdEyCN8yEy814 f7A+54Q/rGaf5lgAnwo0YZPjHcFvy4gzrIjFWt6u/2JG3M3WrGjWRG3ePw6gkAzp 60ygtnE/NYaICPMRxbm4y55+Y8IGBrTUfMSRQ66IHxqmAdsDVeuF7hnmDuqeN6OL XDmAsA81euP2vEHy1HKwiYQTKgOsAGR79h6GLtya01mdLQ0fsZgTCrc1HK2bqkfG p59lfncTt+B5tDJZpTAVyzrcm0rcEYBhJCy9n5FTZ7D7hKqpNqUp+G3k6vXEq+tW A3+lmOBkeFFZBeDzreETp00cUtDiVol+zoxPwM7rIOZMd2gL5h8c/6TeFaJxyEzQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudehfedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdejtd dmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgt hhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqne cukfhppeeiuddrvdduhedrudefjedrudeivdenucfrrghrrghmpehmrghilhhfrhhomhep mhhitghhrggvlhesphgrqhhuihgvrhdrgiihiienucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 5E911102A0; Thu, 13 Dec 2018 19:20:42 -0500 (EST) Date: Fri, 14 Dec 2018 09:20:38 +0900 From: Michael Paquier To: Amit Langote Cc: Stuart , pgsql-bugs@postgresql.org Subject: Re: Errors creating partitioned tables from existing using (LIKE ) after renaming table constraints Message-ID: <20181214002038.GC2921@paquier.xyz> References: <2047094.V130LYfLq4@station53.ousa.org> <977c72a1-8d56-b77c-37de-808627033654@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6zdv2QT/q3FMhpsV" Content-Disposition: inline In-Reply-To: <977c72a1-8d56-b77c-37de-808627033654@lab.ntt.co.jp> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --6zdv2QT/q3FMhpsV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Dec 13, 2018 at 06:03:35PM +0900, Amit Langote wrote: > What's happening here is that when the ALTER TABLE RENAME CONSTRAINT is > followed by CREATE TABLE (LIKE .. INCLUDING ALL) in the same session, the > latter is referring to *stale* information about constraints of the source > table. You said it works correctly after you drop and re-create the > constraint, but that's only because ALTER TABLE DROP/ADD CONSTRAINT will > correctly invalidate the cached information, so that subsequent CREATE > TABLE sees the correct information from the updated cache. The way to fix > it is to teach ALTER TABLE RENAME CONSTRAINT to reset the cached > information. This analysis looks right to me, and that's indeed a bug. And as far as I can see this is reproducible down to 9.4. I cannot check your patch in details today unfortunately, but I'll try to look at that in the next couple of days and see if there are any surrounding issues. -- Michael --6zdv2QT/q3FMhpsV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlwS91YACgkQnvQgOdby QH39wg/8CFGhpYNDJUsz1kKZu8KnJRrHuVeKRmAyopn70ohUskxvUNefIjFfFySY 5678V1qacHdZk5l+k+NIcdPQf2BMc8d6/NEL46LalAJ9uZ6iBOwiS5nE0GeFv3Vm 6XXHZpZiyjgdoBolANcfnp23ZrqdAiArO59wo1i1EZyjrfrEALUN5I+09VWFrM9O G4uueTwl1Cs1cMSwKcZZYGIx7jq+aX7Z9BTIkmyllh24cNHPZPEcfoaX+XDkF//U VTON4Wadq3Yc2izQXzOPM7Yj6JQlVyfqlZM2eXvHS/POQQvi6PQAqfXAwjDbhOZ5 CFOgqoTWF3iQ1AIGpFYuYcPzykuWZSQIbi6IN0Ok7ZeKK5VvR/kCcQbtq6lkIx9A KF6epmsAdvd+rfe47Is82uNGVXh1bib53to4O9TK35/TxNrWpf5lSBNF3CDe3oc5 w1iwo0N/Jeh9jrr0Fm54zLt5FVSxgT8VijDtQnJO7rDu47z8IQ0C6vGqHykIXjOd RkBlPaHsIY+UPP6sojeXVaqku8dQdDh3YSubuyctiS54blF3R2RiWvREzJIUMLB/ PI2y1s/x+DrxPjUYCkZkHssmC4YdYAIMidXBFT3dqbvTRRv5aKmiRU/7VuXkIbA7 TXbtM4SfvSILK0knB+7GlQMqYZjHV2patak5c4EudBGYvOorzps= =bDjU -----END PGP SIGNATURE----- --6zdv2QT/q3FMhpsV--