Re: cataloguing NOT NULL constraints

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: cataloguing NOT NULL constraints
Date: 2023-08-16 08:02:11
Message-ID: e254d0c9-d767-2420-9a9c-fd821b493acf@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 15.08.23 11:57, Dean Rasheed wrote:
> Something else I noticed when reading the SQL standard is that a
> user-defined CHECK (col IS NOT NULL) constraint should be recognised
> by the system as also making the column not null (setting its
> "nullability characteristic" to "known not nullable"). I think that's
> more than just an artefact of how they say NOT NULL constraints should
> be implemented, because the effect of such a CHECK constraint should
> be exposed in the "columns" view of the information schema -- the
> value of "is_nullable" should be "NO" if the column is "known not
> nullable".

Nullability determination is different from not-null constraints. The
nullability characteristic of a column can be derived from multiple
sources, including not-null constraints, check constraints, primary key
constraints, domain constraints, as well as more complex rules in case
of views, joins, etc. But this is all distinct and separate from the
issue of not-null constraints that we are discussing here.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2023-08-16 08:06:09 Re: pgbench - adding pl/pgsql versions of tests
Previous Message Michael Paquier 2023-08-16 08:02:09 Re: Return value of pg_promote()