Re: ALTER DOMAIN ADD NOT NULL NOT VALID

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Quan Zongliang <quanzongliang(at)yeah(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ALTER DOMAIN ADD NOT NULL NOT VALID
Date: 2025-08-18 08:25:48
Message-ID: CALdSSPhvEjHe0pkNkqO=SAxc4hb5CvXpc7eeDcaBevFyjuMADg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 18 Aug 2025 at 09:09, jian he <jian(dot)universality(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniil Davydov 2025-08-18 08:30:49 Re: POC: Parallel processing of indexes in autovacuum
Previous Message Kirill Reshke 2025-08-18 08:15:18 Re: VM corruption on standby