On 05.09.23 18:24, Alvaro Herrera wrote:
On 2023-Sep-05, Peter Eisentraut wrote:
The following information schema views are affected by the not-null
constraint catalog entries:
1. CHECK_CONSTRAINTS
2. CONSTRAINT_COLUMN_USAGE
3. DOMAIN_CONSTRAINTS
4. TABLE_CONSTRAINTS
Note that 1 and 3 also contain domain constraints.
After looking at what happens for domain constraints in older versions
(I tested 15, but I suppose this applies everywhere), I notice that we
don't seem to handle them anywhere that I can see. My quick exercise is
just
create domain nnint as int not null;
create table foo (a nnint);
and then verify that this constraint shows nowhere -- it's not in
DOMAIN_CONSTRAINTS for starters, which is I think the most obvious place.
And nothing is shown in CHECK_CONSTRAINTS nor TABLE_CONSTRAINTS either.
This did ever work in the past? I tested with 9.3 and didn't see
anything there either.
No, this was never implemented. (As I wrote in my other message on the
other thread, arguably a bit buggy.) We could fix this separately,
unless we are going to implement catalogued domain not-null constraints
soon.