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.