public inbox for [email protected]
help / color / mirror / Atom feedFrom: Adrian Klaver <[email protected]>
To: Stuart Campbell <[email protected]>
To: [email protected]
Subject: Re: Check whether a NOT NULL check constraint has been validated
Date: Sun, 30 Nov 2025 19:07:47 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAAZ6SnyOmabkioC3n8GCk5dWQsx57pCSiZy_x1JEOrY7aejxaA@mail.gmail.com>
References: <CAAZ6SnyOmabkioC3n8GCk5dWQsx57pCSiZy_x1JEOrY7aejxaA@mail.gmail.com>
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 <table> where <col> IS NULL;
2) From here
https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-NOTES
ALTER TABLE <table> VALIDATE CONSTRAINT <constraint_name>;
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
[email protected]
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Check whether a NOT NULL check constraint has been validated
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox