Re: information_schema and not-null constraints

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: information_schema and not-null constraints
Date: 2023-09-06 11:02:50
Message-ID: c583dc24-e4e4-fb65-102e-25e7258943a8@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo NAGATA 2023-09-06 11:13:34 Re: pgbnech: allow to cancel queries during benchmark
Previous Message vignesh C 2023-09-06 10:58:39 Re: pg_upgrade and logical replication