diff options
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/catalogs.sgml | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 8504555bac..d6c28c8de3 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1820,11 +1820,13 @@ <para> The catalog <structname>pg_constraint</structname> stores check, primary - key, unique, foreign key, and exclusion constraints on tables. + key, unique, foreign key, exclusion constraints and additional information + of not-null constraints on tables. (Column constraints are not treated specially. Every column constraint is equivalent to some table constraint.) - Not-null constraints are represented in the <structname>pg_attribute</> - catalog, not here. + Not-null constraints are primarily represented in the <structname>pg_attribute</> + catalog, but each attribute which has a not-null constraint in <structname>pg_attribute</> + has additional inheritance information stored in <structname>pg_constraint</>. </para> <para> @@ -1873,6 +1875,7 @@ <entry> <literal>c</> = check constraint, <literal>f</> = foreign key constraint, + <literal>n</> = not-null constraint <literal>p</> = primary key constraint, <literal>u</> = unique constraint, <literal>t</> = constraint trigger, @@ -1993,7 +1996,8 @@ <entry><type>int2[]</type></entry> <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry> <entry>If a table constraint (including foreign keys, but not constraint - triggers), list of the constrained columns</entry> + triggers), list of the constrained columns. This column is used to store + the referenced attribute number of a not-null constraint, too</entry> </row> <row> @@ -2058,6 +2062,15 @@ index.) </para> + <para> + Not-null constraints are used to store inheritance information for each not-null + constraint attached to a column. They shouldn't be confused with check + constraints, since they are handled differently. If a column in <structname>pg_attribute</> + has its <structfield>attnotnull</> set, there must be a matching not-null constraint + in <structname>pg_constraint</> with the attribute number of the column stored in + <structfield>conkey</>. There is always only one attribute number stored at the same time. + </para> + <note> <para> <structfield>consrc</structfield> is not updated when referenced objects |
