Re: NOT NULL NOT ENFORCED

2025-10-18 Thread Álvaro Herrera
On 2025-Sep-24, jian he wrote: > currently NOT VALID NOT NULL dumped > constraint separately, NOT NULL NOT ENFORCED constraints can also be dumped > separately. > > CREATE TABLE tx3 (x int not null not enforced); > > can be dumped as: > > CREATE TABLE public.tx3 (x integer); > ALTER TABLE publi

Re: NOT NULL NOT ENFORCED

2025-09-24 Thread jian he
On Thu, Sep 4, 2025 at 8:00 PM Álvaro Herrera wrote: > > On 2025-Sep-04, jian he wrote: > > > @@ -3093,6 +3115,16 @@ AddRelationNotNullConstraints(Relation rel, List > > *constraints, > > conname = other->name; > > > > inhcount++

Re: NOT NULL NOT ENFORCED

2025-09-10 Thread Peter Eisentraut
On 04.09.25 17:20, jian he wrote: On Thu, Sep 4, 2025 at 8:00 PM Álvaro Herrera wrote: @@ -1272,33 +1294,41 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla * Reproduce not-null constraints, if any, by copying them. We do this * regardless

Re: NOT NULL NOT ENFORCED

2025-09-08 Thread Álvaro Herrera
On 2025-Sep-08, jian he wrote: > set pg_attribute.attnotnull to true for not-valid not-null is still > useful for INSERT/UPDATE. > set pg_attribute.attnotnull to true for not-enforced not-null > constraints doesn't have real benefits, IMHO. Yeah, you might be right about this actually. What we w

Re: NOT NULL NOT ENFORCED

2025-09-08 Thread jian he
On Thu, Sep 4, 2025 at 8:00 PM Álvaro Herrera wrote: > > > @@ -9937,9 +9962,9 @@ ATAddCheckNNConstraint(List **wqueue, > > AlteredTableInfo *tab, Relation rel, > >* If adding a valid not-null constraint, set the > > pg_attribute flag > >* and tell phase 3 to verif

Re: NOT NULL NOT ENFORCED

2025-09-05 Thread Álvaro Herrera
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,

Re: NOT NULL NOT ENFORCED

2025-09-04 Thread jian he
On Thu, Sep 4, 2025 at 8:00 PM Álvaro Herrera wrote: > > > @@ -1272,33 +1294,41 @@ transformTableLikeClause(CreateStmtContext *cxt, > > TableLikeClause *table_like_cla > >* Reproduce not-null constraints, if any, by copying them. We do > > this > >* regardless of options given.

Re: NOT NULL NOT ENFORCED

2025-09-04 Thread Álvaro Herrera
On 2025-Sep-04, jian he wrote: > @@ -3093,6 +3115,16 @@ AddRelationNotNullConstraints(Relation rel, List > *constraints, > conname = other->name; > > inhcount++; > + > + /* > +