Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzw9c-0088Qf-3f for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Apr 2024 10:16:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rzw9Z-005MXQ-Gw for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Apr 2024 10:16:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzw9Z-005MXI-5W for pgsql-hackers@lists.postgresql.org; Thu, 25 Apr 2024 10:16:33 +0000 Received: from wfhigh1-smtp.messagingengine.com ([64.147.123.152]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rzw9W-004ZEU-BI for pgsql-hackers@lists.postgresql.org; Thu, 25 Apr 2024 10:16:31 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.west.internal (Postfix) with ESMTP id 0FCFB1800106; Thu, 25 Apr 2024 06:16:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 25 Apr 2024 06:16:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1714040187; x= 1714126587; bh=SWuf4HeEBnyVTpxnwiIA1ridgSi4Bi6tU0drf+YHkGA=; b=V YQLhwq4O5OQPRqwhEveJbTJn6ACaUMtoZ47N/MSYaidV1Nnbifv0ylV0IcW7ULqU Z92NGUJ4TSZHGoSfhS5iYQ0xXk/PFKDayBtUAtEqxa2q1bQfDxInZN4b9w2p5Qbs 6028s9ffqXOvup0kdlKizjel0t81LeyTv+hmt3qGMD6uMxTgTUrB4d0m4+9Vazjh X2+dMo2905TuVXOjoJS5NUX31bI+a0fIP2YBwQUVOmlgO0RpwljDDhuHGMwqP339 +9IUn3fzLEbVO5rjXEPbCQiKNEbTLS+J2LT2V5m2jlotcZSm0f8lDoyxLqFMCED7 /AYl12MsdcwQtiR17L9Bg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeljedgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepkedthfekveduuefgueelteekgfejgeekueduudeuveeu vddufffggfetiefhvdefnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghdpvg hnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Apr 2024 06:16:26 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1714040185; bh=rcq2gd1+OWC9mFapI6kixMdZyc9Zkenn11pHT/LHqnM=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=UxbHo6FWmc4yPSk80FdO+0TcjgTzDaZLpuY8VkxryAiPo592lR+v+LARzhZJzaYwW EuGq0pKMSCPTQJUGew+U/DHL+Ag+EUpACyGuJUu2sS/XROWQhQXtBIOnVOEPQkMyJL ygBiaMGA5gexqC/NXqVJ67UPP0PXi7PSfkdPE7n9UUFMsdo4Ob1O8CuloGBE9Y6RCm epGj6QQjV5Lx5xlEBVRG6sAz9zVA2lS6CTjt7jw72oJe79MUM2MENlRL0yezsqWQZX gmnj35zjsHt33sbUe7VHH7WGGR1SA1/gor4NX4djQqqKO/9wDpRCyGRZVZYD/3GLPn Qm/I4d2FjNMyA== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 2E6AC9B; Thu, 25 Apr 2024 12:16:25 +0200 (CEST) Date: Thu, 25 Apr 2024 12:16:25 +0200 From: Alvaro Herrera To: Alexander Lakhin Cc: Dean Rasheed , Andrew Bille , Peter Eisentraut , Robert Haas , pgsql-hackers@lists.postgresql.org Subject: Re: cataloguing NOT NULL constraints Message-ID: <202404251016.m2jyipj2zaav@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7d923a66-55f0-3395-cd40-81c142b5448b@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Apr-25, Alexander Lakhin wrote: > While studying the NO INHERIT option, I've noticed that the documentation > probably misses it's specification for NOT NULL: > https://www.postgresql.org/docs/devel/sql-createtable.html > > where column_constraint is: > ... > [ CONSTRAINT constraint_name ] > { NOT NULL | >   NULL | >   CHECK ( expression ) [ NO INHERIT ] | Hmm, okay, will fix. > Also, I've found a weird behaviour with a non-inherited NOT NULL > constraint for a partitioned table: > CREATE TABLE pt(a int NOT NULL NO INHERIT) PARTITION BY LIST (a); > CREATE TABLE dp(a int NOT NULL); > ALTER TABLE pt ATTACH PARTITION dp DEFAULT; > ALTER TABLE pt DETACH PARTITION dp; > fails with: > ERROR:  relation 16389 has non-inherited constraint "dp_a_not_null" Ugh. Maybe a way to handle this is to disallow NO INHERIT in constraints on partitioned tables altogether. I mean, they are a completely useless gimmick, aren't they? -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/