| From: | Sebas Mannem <sebas(at)mannem(dot)nl> |
|---|---|
| To: | jian he <jian(dot)universality(at)gmail(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: NOT NULL NOT ENFORCED |
| Date: | 2026-10-05 07:06:24 |
| Message-ID: | jG5zRUVswgZ4kOUi2v_McMV-f0Dfu3a4GOrI3TnG9raueRqQRnwVQtOnkAnymSkGrsqrQsj9eA_dXIYIwBuao1U-039nnWSMnVgZqx2HbXg=@mannem.nl |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Yeas, much clearer, thanks.
I will try to compile and check some syntax and get back ASAP.
On Monday, 28 September 2026 at 07:04, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> On Fri, Sep 11, 2026 at 2:47 PM Sebas Mannem <sebas(at)mannem(dot)nl> wrote:
> >
> > Hi,
> > this commit message could be much clearer on what the patch does.
>
> I refactored some comments and rebased it.
> Please check the attached v6.
> Below is the full commit message:
> NOT NULL NOT ENFORCED
>
> This completes SQL feature F492 (Optional table constraint enforcement), which
> previously carried the remark "except not-null constraints" in sql_features.txt.
>
> A NOT ENFORCED not-null constraint is stored in pg_constraint with both
> conenforced and convalidated fields set to false, and pg_attribute.attnotnull is
> left false as well. Nulls are accepted and existing rows are not verified.
>
> Rules for NOT-NULL constraint:
> * A column has at most one not-null constraint, enforced or not. Adding
> one with a different enforcement status is not allowed.
> * ALTER COLUMN SET NOT NULL and VALIDATE CONSTRAINT cannot be applied to a NOT
> ENFORCED not-null constraint, since it cannot be validated currently.
> * PRIMARY KEY, SERIAL and IDENTITY columns cannot use not enforced
> not-null constraint.
> * ALTER CONSTRAINT ... [NOT] ENFORCED syntax is not supported for
> not-null constraint currently.
> * DROP NOT NULL removes a NOT ENFORCED constraint as well.
> * ALTER TABLE DROP NOT NULL will drop the not enforced one as well.
>
> Inheritance and partitioning:
> * If the parent's constraint is ENFORCED, the child's must be ENFORCED.
> * If the parent's constraint is NOT ENFORCED, the child's may be either,
> but the child must still have one.
> * A column inheriting conflicting statuses from several parents gets an
> ENFORCED constraint.
>
> commitfest: https://commitfest.postgresql.org/patch/6029
> reference: https://git.postgresql.org/cgit/postgresql.git/commit/?id=a379061a22a8fdf421e1a457cc6af8503def6252
> discussion: https://postgr.es/m/CACJufxFbH1_9BDow=4nMSdBfLSOAkiGD5hxO6bouWjZAyHbV+A@mail.gmail.com
> -----------------------------------------------
>
>
>
> --
> jian
> https://www.enterprisedb.com/
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zhijie Hou | 2026-10-05 07:38:30 | Re: Fix apply worker crash when subscriber table has only a deferrable primary key |
| Previous Message | vignesh C | 2026-10-05 07:01:59 | Re: Publication DDL can race with a concurrent UPDATE |