Re: information_schema and not-null constraints - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: information_schema and not-null constraints
Date
Msg-id 202309051715.7ghhtqh76hyw@alvherre.pgsql
Whole thread Raw
In response to Re: information_schema and not-null constraints  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: information_schema and not-null constraints
List pgsql-hackers
On 2023-Sep-05, Alvaro Herrera wrote:

> 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.

Looking now at what to do for CHECK_CONSTRAINTS with domain constraints,
I admit I'm completely confused about what this view is supposed to
show.  Currently, we show the constraint name and a definition like
"CHECK (column IS NOT NULL)".  But since the table name is not given, it
is not possible to know to what table the column name refers to.  For
domains, we could show "CHECK (VALUE IS NOT NULL)" but again with no
indication of what domain it applies to, or anything at all that would
make this useful in any way whatsoever.

So this whole thing seems pretty futile and I'm disinclined to waste
much time on it.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: A minor adjustment to get_cheapest_path_for_pathkeys
Next
From: Nazir Bilal Yavuz
Date:
Subject: Re: Create shorthand for including all extra tests