Re: ALTER DOMAIN ADD NOT NULL NOT VALID - Mailing list pgsql-hackers

From Kirill Reshke
Subject Re: ALTER DOMAIN ADD NOT NULL NOT VALID
Date
Msg-id CALdSSPhvEjHe0pkNkqO=SAxc4hb5CvXpc7eeDcaBevFyjuMADg@mail.gmail.com
Whole thread Raw
In response to Re: ALTER DOMAIN ADD NOT NULL NOT VALID  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On Mon, 18 Aug 2025 at 09:09, jian he <jian.universality@gmail.com> wrote:

> CREATE DOMAIN use ColConstraintElem.
> that's why we do not support syntax:
> ``create domain t1 as int not null not valid;``
>
> we also do not support column constraints NOT NULL NOT VALID.
> Like
> ``create table t(a int not null not valid);``
> will error out.
> so I guess it's fine to not support it?

Indeed.

> so currently I don't know how to support syntax
> ``create domain t1 as int not null not valid;``

Ok.

> I also found it's hard to psql-tab-complete for
>  'alter domain ... add constraint .. not null' with 'not valid'.

I am under the impression it is pretty trivial.
I mean, isn't this enough?

```
/* ALTER DOMAIN <sth> ADD CONSTRAINT <sth> NOT NULL */
else if (Matches("ALTER", "DOMAIN", MatchAny, "ADD", "CONSTRAINT",
MatchAny, "NOT", "NULL"))
COMPLETE_WITH("NOT VALID");
```

Anyway, this is purely optional and can be a separate topic.

I propose to focus on Alvaro's feedback for now.

-- 
Best regards,
Kirill Reshke



pgsql-hackers by date:

Previous
From: Kirill Reshke
Date:
Subject: Re: VM corruption on standby
Next
From: Daniil Davydov
Date:
Subject: Re: POC: Parallel processing of indexes in autovacuum