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 1lPXDX-0001CB-Gu for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Mar 2021 21:08:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lPXDW-0000VI-D8 for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Mar 2021 21:08:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lPXDW-0000VA-6Y for pgsql-hackers@lists.postgresql.org; Thu, 25 Mar 2021 21:08:34 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lPXDU-0002T3-By for pgsql-hackers@lists.postgresql.org; Thu, 25 Mar 2021 21:08:33 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 64EEA5C0083; Thu, 25 Mar 2021 17:08:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 25 Mar 2021 17:08:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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= fm2; bh=PuZzlM88l8zvyU2OJ/UYLwJcBgT8nUlAOolsG4UVuFI=; b=gNzqnPRd Mf7NBBlewYgvAZTm5eNGs4OKlhEotoF7EzdT4f5sXcoVWmRuUglX3OdE+02/rkMI DB33+HECKrFgU6ZKTdPVkjEB9a/J/WKd8uSdbZZMAwHuykV3H+QbgYEJNZ2xNRAq ij4PvmtpZ2YvqOkihLMVRc6PJO4O0FFgtwNDeV2pHPhM+EoB4WiaqUjSDrKaoHY9 ZiUwUutc9zRWh3EVlg9wXPsreA0fY1dee+4vzfQjklDHDaLfjQPn6Mic0BsrE95U 9WArehJN1cOvLKF2A/XG5K/FKss4n5HO3kfE+7TEjWpiYldZ+3QUJ/LV3ywn9ban Hi1sZQNLOtqw4w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudehtddgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtugfgjggfsehtkeertddtredunecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpeeufffhjeeiueeuffegvddukeegledtveeivdeiueef ieeivefgteehueefteehvdenucfkphepudeltddrleehrdduledrleehnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegr lhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.95]) by mail.messagingengine.com (Postfix) with ESMTPA id 8896D1080063; Thu, 25 Mar 2021 17:08:29 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id F26E22A0FC3; Thu, 25 Mar 2021 18:08:27 -0300 (-03) Date: Thu, 25 Mar 2021 18:08:27 -0300 From: Alvaro Herrera To: Justin Pryzby Cc: Amit Langote , pgsql-hackers@lists.postgresql.org Subject: Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY Message-ID: <20210325210827.GA32484@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201201013051.GA24052@telsasoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2020-Nov-30, Justin Pryzby wrote: > On Tue, Nov 03, 2020 at 08:56:06PM -0300, Alvaro Herrera wrote: > > * On the first transaction (the one that marks the partition as > > detached), the partition is locked with ShareLock rather than > > ShareUpdateExclusiveLock. This means that DML is not allowed anymore. > > This seems a reasonable restriction to me; surely by the time you're > > detaching the partition you're not inserting data into it anymore. > > I don't think it's an issue with your patch, but FYI that sounds like something > I had to do recently: detach *all* partitions of various tabls to promote their > partition key column from timestamp to timestamptz. And we insert directly > into child tables, not routed via parent. > > I don't your patch is still useful, but not to us. So the documentation should > be clear about that. FWIW since you mentioned this detail specifically: I backed away from doing this (and use ShareUpdateExclusive), because it wasn't buying us anything anyway. The reason for it is that I wanted to close the hole for RI queries, and this seemed the simplest fix; but it really *wasn't* a fix anyway. My later games with the active snapshot (which are present in the version I pushed) better close this problem. So I don't think this would be a problem. -- Álvaro Herrera Valdivia, Chile