On 2023-Nov-23, Aleksander Alekseev wrote: > Interestingly enough according to the documentation this syntax is > already supported [1][2], but the actual query will fail on `master`: > > ``` > =# create domain connotnull integer; > CREATE DOMAIN > =# alter domain connotnull add not null value; > ERROR: unrecognized constraint subtype: 1 > ```
Hah, nice ... this only fails in this way on master, though, as a side-effect of previous NOT NULL work during this cycle. So if we take Peter's patch, we don't need to worry about it. In 16 it behaves properly, with a normal syntax error. > ``` > =# create domain connotnull1 integer; > =# create domain connotnull2 integer; > =# alter domain connotnull1 add not null value; > =# alter domain connotnull2 set not null; > =# \dD > ERROR: unexpected null value in cached tuple for catalog > pg_constraint column conkey > ``` This is also a master-only problem, as "add not null" is rejected in 16 with a syntax error (and obviously \dD doesn't fail). > NOT VALID is not supported: > > ``` > =# alter domain connotnull add not null value not valid; > ERROR: NOT NULL constraints cannot be marked NOT VALID > ``` Yeah, it'll take more work to let NOT NULL constraints be marked NOT VALID, both on domains and on tables. It'll be a good feature for sure. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "La victoria es para quien se atreve a estar solo"