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 CALdSSPiUiVya+L-642ffcvVPYWN0kysCeOhy3aho57GzxuYS=g@mail.gmail.com
Whole thread Raw
In response to Re: ALTER DOMAIN ADD NOT NULL NOT VALID  (jian he <jian.universality@gmail.com>)
Responses Re: ALTER DOMAIN ADD NOT NULL NOT VALID
List pgsql-hackers
On Thu, 14 Aug 2025 at 07:47, jian he <jian.universality@gmail.com> wrote:
>
> hi.
> rebase and minor cosmetic change.

Hi!
It appears satisfactory to me.
I have few observations.
One is whether we should now support CREATE DOMAIN ... NOT NULL NOT
VALID syntax? This could be a separate patch though.
Second observation is just a question:

```

reshke=# create domain dd as int;
CREATE DOMAIN
reshke=# create table dt(i int, c dd);
CREATE TABLE
reshke=# insert into dt values(1,null);
INSERT 0 1
reshke=# alter domain dd add constraint c not null not valid ;
ALTER DOMAIN
reshke=# update dt set i = i + 1;
UPDATE 1
reshke=# update dt set i = i + 1, c =null;
ERROR:  domain dd does not allow null values
reshke=# table dt;
 i | c
---+---
 2 |
(1 row)

```

Is this behaviour correct? Meaning first update is successful while
second is not, yet they would produce the same result.

And last is about psql-tab-complete: we now can complete 'alter domain
... add constraint .. not null' with 'not valid'. This also  could be
a separate patch.

-- 
Best regards,
Kirill Reshke



pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: Making jsonb_agg() faster
Next
From: Benoit Tigeot
Date:
Subject: Re: pg_stat_statements: Add `calls_aborted` counter for tracking query cancellations