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 1u0Fc8-00FAqm-2Z for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Apr 2025 08:07:52 +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 1u0Fc6-004cXU-9x for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Apr 2025 08:07:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u0Fc5-004cXL-Sh for pgsql-hackers@lists.postgresql.org; Thu, 03 Apr 2025 08:07:49 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u0Fc3-0037U1-1E for pgsql-hackers@postgresql.org; Thu, 03 Apr 2025 08:07:49 +0000 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id A89C925401DE; Thu, 3 Apr 2025 04:07:44 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Thu, 03 Apr 2025 04:07:44 -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-sender :x-me-sender:x-sasl-enc; s=fm2; t=1743667664; x=1743754064; bh=w ka69bn3zjwfSA/vWloSSP7G2YgtojxN3h5tL7mhJQc=; b=lY/xep9uiJe5m9mhB TV8z1zxWCUcb+accdUgD8uRX5vhRqe4fZFmgsbfdZb8gBzuPjVGDTI2ULwiZIt9R FAWCyrHgMl5w4ltsfN/qBcoC6xmnFAZpo7L9QtMO9pDMUprgUDL1DQAx1N4+XLJn JP8F1ZWFKRSRoKrJRScIWo1JpJZgkw+GGwDqGb2KcaqU6iSW2Vxq9t4/jySdTDAw EQGpgumG7HF9LoG5wKhPH/OdHdm/e0zi0gDdCSU7alMyGudfCL20t5MQ9id/8iVs rB/WhfGG9omc9rG0UbDj3oPTKRMb8WUBHOmPIFnP2OvLdLrApFTo93RTCXlyo3eS muBww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddukeektdegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesthekredttddt jeenucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlh hvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffeh fffhjeejhffgieeuueekjeekfffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvg hrphhrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsg gprhgtphhtthhopeeipdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehpvghtvghr segvihhsvghnthhrrghuthdrohhrghdprhgtphhtthhopegrshhhuhhtohhshhdrsggrph grthdrohhsshesghhmrghilhdrtghomhdprhgtphhtthhopehjihgrnhdruhhnihhvvghr shgrlhhithihsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhhosggvrhhtmhhhrggrsh esghhmrghilhdrtghomhdprhgtphhtthhopehruhhshhgrsghhrdhlrghthhhirgesghhm rghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhsthhgrh gvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Apr 2025 04:07:44 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1743667661; bh=9bxGL5ZikyocBlZmbFhVjsAje063iiOxGjj1XaJsH6I=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=iCxj/8BupxWc4k/uQkwaU6R6UV58UyGUp7nxiRzZCuQ0HBr+X1GmQgwn+nhoj3u2P Ahk8N9vPFJatAHdW+O8gBJRGgc4pt+6ox5ioX8tzvC3oeWMZzwGGwyArPtvXAvStTu DP4vbBi9FLrFXuyzISz+bJf+KsqkZmvplk+ZYl4lwsGLhyrjLtb5DFz/8hz2ZrId6k FuButzjE5dHXP6wCzAoTGIPkXRyBE3m09B2kxxoaIV9uzwflqdwMtfO2LnYAic4aay DxW9D0+q1n2CVPMqnAupiT+n+0fppy1iY4w2hnkazqFdRjAxRzNZhLWyLE5XuHQCKQ wZhz+TROBTM5w== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 6863489; Thu, 3 Apr 2025 10:07:41 +0200 (CEST) Date: Thu, 3 Apr 2025 10:07:41 +0200 From: Alvaro Herrera To: Peter Eisentraut Cc: jian he , Robert Haas , Rushabh Lathia , Ashutosh Bapat , PostgreSQL Hackers Subject: Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints Message-ID: <202504030807.sj5yexcmrgpq@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Apr-03, Peter Eisentraut wrote: > It occurred to me that we will also want to have NOT NULL NOT ENFORCED > constraints eventually. As we have discussed elsewhere, the NOT > ENFORCED state is closely related to the NOT VALID state. So that > should probably be considered in the design here. Yeah, I don't think there's time to shoehorn NOT ENFORCED status for not-null constraints. I'd guess that it'd take at least a couple of weeks to make that work. > Reading up on this again now, I'm confused about putting the NOT VALID > state for not-null constraints into pg_attribute. We have catalogued > not-null constraints now, so we can put metadata for them into > pg_constraint! And we have NOT VALID and NOT ENFORCED flags in > pg_constraint already. > > So what is the purpose of the attnotnullvalid field? In the latest posted > patch, I don't see this column used in the executor for the actual > constraint checking. So is this all merely for clients to understand the > constraint metadata? If we add more metadata for not-null constraints, do > we need to add a new pg_attribute flag for each one? That doesn't seem > right. The new flag is there for quick access by get_relation_info. We could easily not have it otherwise, because clients don't need it, but its lack would probably make planning measurably slower because it'd have to do syscache access for every single not-null constraint to figure out if it's valid or not. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Hay quien adquiere la mala costumbre de ser infeliz" (M. A. Evans)