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 1vQ1fe-006FCC-0S for pgsql-general@arkaria.postgresql.org; Mon, 01 Dec 2025 11:02:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQ1fc-002DBx-0A for pgsql-general@arkaria.postgresql.org; Mon, 01 Dec 2025 11:02:16 +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 1vQ1fb-002DBn-28 for pgsql-general@lists.postgresql.org; Mon, 01 Dec 2025 11:02:16 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQ1fZ-002VEC-1F for pgsql-general@postgresql.org; Mon, 01 Dec 2025 11:02:15 +0000 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-94905c3e2a4so215692939f.1 for ; Mon, 01 Dec 2025 03:02:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ridewithvia.com; s=google; t=1764586931; x=1765191731; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mt9cokuxpgTHa3EsbHbMkhwKiWfR50ybDSJ882c9sIs=; b=Nmx4JqlQpQOU2UmXfCtbFyVVC+KkU35plNoIh64Q1riigOgrEYaCAqPCKS+kXylNTN RLaucgDQszY1IQzlFT3Rut7vP5LYg21goCAVGJTdW4whazGSF1Lql0fz2fJnfdNp11HA iEJKFzGLlaPgaeFDQV7dY8TAlv3RKf8/DM6u4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764586931; x=1765191731; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mt9cokuxpgTHa3EsbHbMkhwKiWfR50ybDSJ882c9sIs=; b=h7Tqu4CDxBiRWjfUf/V+iUNKyXthMtfKCWMGFRQnj+STgOhx8zxifawdMenuSP8Dex 9Ti3to/2il967QUG9vu6jwe3/WeFBH+9NT7ps5FGiMdYf8R+n49pmm4NrffTob2+AXXt zEFy+TQiPaK/vMqTaKAuPc/3ajdhFBp4qTSifdxkkXL+T1BfQa+2+orRpqKp5MakEo6o c/kzHty+7chbquSfxqtpnIEnFOaoIe1T76ABaeoQTQh55ucZe1aYe/KXN2RJ9S3zM0Se FAJhscXrtXEQ7ye4IEQQ68ty5lzR6Tbt6PhrVuxojrg1yP+4ADGZFx6XYGr2iCs2Bt9t gvdA== X-Gm-Message-State: AOJu0YzA2Rvx3gIhfbIaGJ2+Vf9KX4y9sMAY0oSFHpH8uQtLChSmVkmI nEmR7LR8dIaPM1zoopRb8nfpyhdWPU98s07C9x6GhWIny8bBvQT4iTUgeEUFWWSMKMBoJOX9hlx UaDuRd5c11+6AHs5ejlcUewGpm3Ts85YGiwEq+sjfOJg494YtlHfN0NOMJZAw3FW+pICTtckPug sWIf6g4ApNALJ05AMqFEAvSBae9KEztU76afi609m8gFZxubp0hOXY X-Gm-Gg: ASbGncvwGTa4usASkiVAR5KDUnQw+49nCukbnuiUD3cTyKGJY7Uq4ggM7wE2r+8pp2L SJefVMf0VaY5Pd31K+RDU0XWDF3r71oYZ1RZyrCRRtgn7OiGXw6emtjNDV+uWwyRoqakKfF+I6z IpODgi+Zhwqs94Q92Hq7VLyVKrq1v0ao0weRP93FqZoVdYvoS8R1mdcLQk6CLMi06IC0yhi2kUk IHUwfKaNlar9uFq7C0HfDnR9qzpNYXY/ks4MEACXq4oa7nNQ5B1k3dwkMD5m0uaYQWTyx0= X-Google-Smtp-Source: AGHT+IGXuiEx/KcBwU489wYIpRPfomYflqabvNiHjjD7xf/jomfxa+2ysMIzoT7+gYeBMOQZexKlg9jX9II/T1dt1Bg= X-Received: by 2002:a05:6638:c748:20b0:5b7:3f3c:67d4 with SMTP id 8926c6da1cb9f-5b956913d77mr29959006173.9.1764586930866; Mon, 01 Dec 2025 03:02:10 -0800 (PST) MIME-Version: 1.0 References: <1b930bcc-16f4-4c97-93f8-a21d314ba373@aklaver.com> <301832e8-a3d7-46f5-9db5-691b71eee9ac@aklaver.com> In-Reply-To: <301832e8-a3d7-46f5-9db5-691b71eee9ac@aklaver.com> From: Stuart Campbell Date: Mon, 1 Dec 2025 22:02:00 +1100 X-Gm-Features: AWmQ_bl1R-PPTMoWjxhMbMORMWNMFqIIN2n6Eyw3783Dnl081KrVRgW2ItrrsYk Message-ID: Subject: Re: Check whether a NOT NULL check constraint has been validated To: Adrian Klaver Cc: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="00000000000030a0db0644e1e9e4" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000030a0db0644e1e9e4 Content-Type: text/plain; charset="UTF-8" Hi Adrian, > Now I am not sure what you did. > > Are you saying you used a CHECK constraint to check for NULL values? That's right. Something like: ALTER TABLE foo ADD CONSTRAINT bar_not_null CHECK (bar IS NOT NULL) NOT VALID > If so then pg_constraint.convalidated would work. You're right. I didn't immediately find what I was looking for, and when I looked at the docs for pg_constraints, I guess I confused myself with this comment: > Not-null constraints are represented in the pg_attribute catalog, not here. Thanks for the assistance. -- 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. --00000000000030a0db0644e1e9e4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi A= drian,
=C2=A0
Now I am not sure what you did.

Are you saying you used a CHECK constraint to check for NULL values?

That's right. Something like:

<= /div>
=C2=A0 ALTER TABLE foo ADD = CONSTRAINT bar_not_null CHECK (bar IS NOT NULL) NOT VALID=C2=A0
=C2=A0
If so then pg_constraint.convalidated would work.

You're right. I didn't immediately find what I was looking f= or, and when I looked at the docs for pg_constraints, I guess I confused my= self with this comment:

>=C2=A0Not-null constra= ints are represented in the pg_attribute catalog, not= here.
=C2=A0
Thanks for the assistance.

This communication and any attachments may contain confidential inform= ation 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.


--00000000000030a0db0644e1e9e4--