doc: Clarify not-null constraints in information schema
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 4 Oct 2023 13:03:48 +0000 (15:03 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 4 Oct 2023 13:03:48 +0000 (15:03 +0200)
Add a bit of clarification in various places that not-null constraints
are included under check constraints in the information schema.

doc/src/sgml/information_schema.sgml

index d57a1323409afd3ad048409ebd77f1d8a263e0a5..9c39e9aab504b024f02b95e249bdebdfe6dcabef 100644 (file)
    domain is the owner of the constraint.)
   </para>
 
+  <para>
+   The SQL standard considers not-null constraints to be check constraints
+   with a <literal>CHECK (<replaceable>column_name</replaceable> IS NOT
+   NULL)</literal> expression.  So not-null constraints are also included here
+   and don't have a separate view.
+  </para>
+
   <table>
    <title><structname>check_constraints</structname> Columns</title>
    <tgroup cols="1">
    columns in the current database that are used by some constraint.
    Only those columns are shown that are contained in a table owned by
    a currently enabled role.  For a check constraint, this view
-   identifies the columns that are used in the check expression.  For
+   identifies the columns that are used in the check expression.  For a
+   not-null constraint, this view identifies the column that the constraint is
+   defined on.  For
    a foreign key constraint, this view identifies the columns that the
    foreign key references.  For a unique or primary key constraint,
    this view identifies the constrained columns.
@@ -6856,7 +6865,7 @@ ORDER BY c.ordinal_position;
        <structfield>constraint_type</structfield> <type>character_data</type>
       </para>
       <para>
-       Type of the constraint: <literal>CHECK</literal>,
+       Type of the constraint: <literal>CHECK</literal> (includes not-null constraints),
        <literal>FOREIGN KEY</literal>, <literal>PRIMARY KEY</literal>,
        or <literal>UNIQUE</literal>
       </para></entry>