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 1lZL5f-0004LN-5d for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Apr 2021 22:12:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lZL5e-0007eV-3I for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Apr 2021 22:12:58 +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 1lZL5d-0007eO-So for pgsql-hackers@lists.postgresql.org; Wed, 21 Apr 2021 22:12:57 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lZL5b-0002zu-F1 for pgsql-hackers@lists.postgresql.org; Wed, 21 Apr 2021 22:12:57 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 6746110AE; Wed, 21 Apr 2021 18:12:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 21 Apr 2021 18:12:52 -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=diI2GRmnZIziZrsSlOfuEN8Grey2POrBIZlxClOADAA=; b=cXmovT0j KEyGh2mjYynO9xBNotzYxeaJ28SbHX88bIO/gURRGRL9DSzVvcpvZnF98sruT9tH +RWpBLPNRY9+mrhUcaPcCD4QlN/bPj8+e94X3ebXyNRpBxFv+aD06rXomnwGLXQs i+XMjbFIgILI/s8ZOXY2J/B+o1bqS6n/2h1Va1jAwRd/SQmYwnqjhIFjWgFolhDn ktO+196Gfw1Whf+xuCedzn3XnuDxpTxVtLlp5p30D2tE1Mf6JGJt0j+B/bPwbXQy eDGydWslJSNZr6Kcgyfa9t6tKM4InNS3ogkho8vi27nB24bXRzlklq/sZIfhEPq4 9ZjDJOsbMSXZRw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddtledgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjfgesthekredttderudenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepueffhfejieeuueffgedvudekgeeltdeviedvieeufeei ieevgfetheeufeethedvnecukfhppeduledtrdelhedrudelrdelheenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghl vhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.95]) by mail.messagingengine.com (Postfix) with ESMTPA id 8967124005C; Wed, 21 Apr 2021 18:12:51 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 2F6372A0BD7; Wed, 21 Apr 2021 18:12:48 -0400 (-04) Date: Wed, 21 Apr 2021 18:12:48 -0400 From: Alvaro Herrera To: Justin Pryzby Cc: Amit Langote , pgsql-hackers@lists.postgresql.org Subject: Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY Message-ID: <20210421221248.GA31877@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210410184226.GY6592@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 2021-Apr-10, Justin Pryzby wrote: > If it *implies* the partition constraint, then it's at least as tight (and > maybe tighter), yes ? > > I think you're concerned with the case that someone has a partition with > "tight" bounds like (a>=200 and a<300) and a check constraint that's "less > tight" like (a>=100 AND a<400). In that case, the loose check constraint > doesn't imply the tighter partition constraint, so your patch would add a > non-redundant constraint. ... yeah, you're right, we can do as you suggest and it seems an improvement. I verified, as is obvious in hindsight, that the existing constraint makes a future ATTACH of the partition with the same bounds as before not scan the partition. I pushed the patch with a small change: PartConstraintImpliedByRelConstraint wants the constraint in implicit-AND form (that is, a list) which is what we already have, so we can postpone make_ands_explicit() until later. Pushed, thanks, -- Álvaro Herrera Valdivia, Chile