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.96) (envelope-from ) id 1vPuGe-0015pN-1F for pgsql-general@arkaria.postgresql.org; Mon, 01 Dec 2025 03:08:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vPuGa-00HRwC-26 for pgsql-general@arkaria.postgresql.org; Mon, 01 Dec 2025 03:07:56 +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.96) (envelope-from ) id 1vPuGZ-00HRw3-1v for pgsql-general@lists.postgresql.org; Mon, 01 Dec 2025 03:07:56 +0000 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vPuGW-002QoR-1Z for pgsql-general@postgresql.org; Mon, 01 Dec 2025 03:07:55 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id 2A01B7A0149; Sun, 30 Nov 2025 22:07:49 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Sun, 30 Nov 2025 22:07:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1764558469; x=1764644869; bh=Xj41f/h64YAIBUxzsYhgrmjR9uVtzgmfaFeisuq/jqI=; b= lRpyTTzv88yCyXdFaX9mbREAj6YpW1sIIEsBOGy8VINWV41tP8EDK/Y3bybN6owP thMKlvntu5WL67RTiXcrN7PdbG8PcUhcAJHXRuvywiZy0b8vLe7EZrbdlCfccIRJ TfPhzOxAjkUbKl4iitx85en/hi9hAuaZVeMaloWWCPrN6EU0k8gK1odwgZePhw8C ic5sTF3vxbQNCJ7LasP4J4JuFYcK/LO5eklEWSDT7Vx9MAr3Rny7E4EWn5SNgCza /wczbVz0dRZJ+VrN0wXEQNLCipsKzRnEDcpo0yWkiP4f3/F/9jlMqP7Tky8NhPzP 3qRZZ5S171rQM2Ymbxej2g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1764558469; x=1764644869; bh=X j41f/h64YAIBUxzsYhgrmjR9uVtzgmfaFeisuq/jqI=; b=fxN+lJR26tPKVETkE +AquigJR/jRZpFaRTT7w6gP682NsL9Xdksb0M6HFoZytmC7ghmpQGb32rbW0m+yO PdAQF9Q0chxHze52YK8s96mat4585e+36SpLA4B4VfkBDe9IEHOTrY34r+WCXbl9 XcQwojbWdLNFjEP6tvLn/oP5f25xT+qM3ogUel/U90yncO5NFCdv2YLyuoFffRnY GODrt6vGfOGdCgTjId0k80ggZkquIjB4gwuD1HnU0vbELRdjxbffg7WiBF7jiD92 jMm44W5lPMPdCGVLfQ2EoviZYagnETYYtGWfDOLBrNjsOFkLvK9J8J/dy2fBg6vT w2pnQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvheeiheelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomheptegurhhirghn ucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqe enucggtffrrghtthgvrhhnpeekfeehuddvjeeigfeifeejtdduudffledvfeelheeftdei ffeugfdvkeelgedtvdenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghn rdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepvddpmhhoug gvpehsmhhtphhouhhtpdhrtghpthhtohepshhtuhgrrhhtrdgtrghmphgsvghllhesrhhi uggvfihithhhvhhirgdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlse hpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 30 Nov 2025 22:07:48 -0500 (EST) Message-ID: <1b930bcc-16f4-4c97-93f8-a21d314ba373@aklaver.com> Date: Sun, 30 Nov 2025 19:07:47 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Check whether a NOT NULL check constraint has been validated To: Stuart Campbell , pgsql-general@postgresql.org References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/30/25 16:59, Stuart Campbell wrote: > Hello, > > I have several NOT NULL check constraints in my schema that were > originally added as NOT VALID. I would like to determine whether they > have all since been validated, or not. > > I thought maybe pg_constraint.convalidated might help, but it seems like > the version of Postgres I'm using (16) doesn't store not null > constraints in that table. And even in later versions, maybe it doesn't > hold the information I need. > > Is there another way to discover this? 1) Select count(*) from where IS NULL; 2) From here https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-NOTES ALTER TABLE
VALIDATE CONSTRAINT ; As described: ". Once the constraint is in place, no new violations can be inserted, and the existing problems can be corrected at leisure until VALIDATE CONSTRAINT finally succeeds." > > This communication and any attachments may contain confidential > information and are intended to be viewed only by the intended > recipients. If you have received this message in error, please notify > the sender immediately by replying to the original message and then > delete all copies of the email from your systems. > > -- Adrian Klaver adrian.klaver@aklaver.com