Re: NOT NULL NOT ENFORCED

Álvaro Herrera <alvherre@kurilemu.de>

From: Álvaro Herrera <alvherre@kurilemu.de>
To: jian he <jian.universality@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-09-05T19:23:30Z
Lists: pgsql-hackers
On 2025-Sep-04, Álvaro Herrera wrote:

> On 2025-Sep-04, jian he wrote:

> > +		else if (notenforced)
> > +		{
> > +			/*
> > +			 * We can't use ATExecSetNotNull here because it adds an enforced
> > +			 * not-null constraint, but here we only want a non-enforced one.
> > +			*/
> 
> Umm, wouldn't it make more sense to modify ATExecSetNotNull() so that it
> does what we want?  This seems hackish.

BTW while you're at that, it might make sense to allow commands like
  ALTER TABLE foo ALTER col1 SET NOT NULL NOT VALID
  ALTER TABLE foo ALTER col1 SET NOT NULL NOT ENFORCED

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"La verdad no siempre es bonita, pero el hambre de ella sí"



Commits

  1. Fix CREATE TABLE LIKE with not-valid check constraint

  2. Add support for NOT ENFORCED in CHECK constraints