summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/catalog-pg-constraint.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/html/catalog-pg-constraint.html')
-rw-r--r--doc/src/sgml/html/catalog-pg-constraint.html197
1 files changed, 197 insertions, 0 deletions
diff --git a/doc/src/sgml/html/catalog-pg-constraint.html b/doc/src/sgml/html/catalog-pg-constraint.html
new file mode 100644
index 0000000..ad9aa8d
--- /dev/null
+++ b/doc/src/sgml/html/catalog-pg-constraint.html
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>51.13. pg_constraint</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="catalog-pg-collation.html" title="51.12. pg_collation" /><link rel="next" href="catalog-pg-conversion.html" title="51.14. pg_conversion" /></head><body id="docContent" class="container-fluid col-10"><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">51.13. <code xmlns="http://www.w3.org/1999/xhtml" class="structname">pg_constraint</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-collation.html" title="51.12. pg_collation">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 51. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 51. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 13.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-conversion.html" title="51.14. pg_conversion">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="CATALOG-PG-CONSTRAINT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">51.13. <code class="structname">pg_constraint</code></h2></div></div></div><a id="id-1.10.4.15.2" class="indexterm"></a><p>
+ The catalog <code class="structname">pg_constraint</code> stores check, primary
+ key, unique, foreign key, and exclusion 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 <code class="structname">pg_attribute</code>
+ catalog, not here.
+ </p><p>
+ User-defined constraint triggers (created with <code class="command">CREATE CONSTRAINT
+ TRIGGER</code>) also give rise to an entry in this table.
+ </p><p>
+ Check constraints on domains are stored here, too.
+ </p><div class="table" id="id-1.10.4.15.6"><p class="title"><strong>Table 51.13. <code class="structname">pg_constraint</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_constraint Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
+ Column Type
+ </p>
+ <p>
+ Description
+ </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">oid</code> <code class="type">oid</code>
+ </p>
+ <p>
+ Row identifier
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conname</code> <code class="type">name</code>
+ </p>
+ <p>
+ Constraint name (not necessarily unique!)
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">connamespace</code> <code class="type">oid</code>
+ (references <a class="link" href="catalog-pg-namespace.html" title="51.32. pg_namespace"><code class="structname">pg_namespace</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ The OID of the namespace that contains this constraint
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">contype</code> <code class="type">char</code>
+ </p>
+ <p>
+ <code class="literal">c</code> = check constraint,
+ <code class="literal">f</code> = foreign key constraint,
+ <code class="literal">p</code> = primary key constraint,
+ <code class="literal">u</code> = unique constraint,
+ <code class="literal">t</code> = constraint trigger,
+ <code class="literal">x</code> = exclusion constraint
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">condeferrable</code> <code class="type">bool</code>
+ </p>
+ <p>
+ Is the constraint deferrable?
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">condeferred</code> <code class="type">bool</code>
+ </p>
+ <p>
+ Is the constraint deferred by default?
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">convalidated</code> <code class="type">bool</code>
+ </p>
+ <p>
+ Has the constraint been validated?
+ Currently, can only be false for foreign keys and CHECK constraints
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conrelid</code> <code class="type">oid</code>
+ (references <a class="link" href="catalog-pg-class.html" title="51.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ The table this constraint is on; 0 if not a table constraint
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">contypid</code> <code class="type">oid</code>
+ (references <a class="link" href="catalog-pg-type.html" title="51.62. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ The domain this constraint is on; 0 if not a domain constraint
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conindid</code> <code class="type">oid</code>
+ (references <a class="link" href="catalog-pg-class.html" title="51.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ The index supporting this constraint, if it's a unique, primary
+ key, foreign key, or exclusion constraint; else 0
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conparentid</code> <code class="type">oid</code>
+ (references <a class="link" href="catalog-pg-constraint.html" title="51.13. pg_constraint"><code class="structname">pg_constraint</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ The corresponding constraint in the parent partitioned table,
+ if this is a constraint in a partition; else 0
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">confrelid</code> <code class="type">oid</code>
+ (references <a class="link" href="catalog-pg-class.html" title="51.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ If a foreign key, the referenced table; else 0
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">confupdtype</code> <code class="type">char</code>
+ </p>
+ <p>
+ Foreign key update action code:
+ <code class="literal">a</code> = no action,
+ <code class="literal">r</code> = restrict,
+ <code class="literal">c</code> = cascade,
+ <code class="literal">n</code> = set null,
+ <code class="literal">d</code> = set default
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">confdeltype</code> <code class="type">char</code>
+ </p>
+ <p>
+ Foreign key deletion action code:
+ <code class="literal">a</code> = no action,
+ <code class="literal">r</code> = restrict,
+ <code class="literal">c</code> = cascade,
+ <code class="literal">n</code> = set null,
+ <code class="literal">d</code> = set default
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">confmatchtype</code> <code class="type">char</code>
+ </p>
+ <p>
+ Foreign key match type:
+ <code class="literal">f</code> = full,
+ <code class="literal">p</code> = partial,
+ <code class="literal">s</code> = simple
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conislocal</code> <code class="type">bool</code>
+ </p>
+ <p>
+ This constraint is defined locally for the relation. Note that a
+ constraint can be locally defined and inherited simultaneously.
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">coninhcount</code> <code class="type">int4</code>
+ </p>
+ <p>
+ The number of direct inheritance ancestors this constraint has.
+ A constraint with
+ a nonzero number of ancestors cannot be dropped nor renamed.
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">connoinherit</code> <code class="type">bool</code>
+ </p>
+ <p>
+ This constraint is defined locally for the relation. It is a
+ non-inheritable constraint.
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conkey</code> <code class="type">int2[]</code>
+ (references <a class="link" href="catalog-pg-attribute.html" title="51.7. pg_attribute"><code class="structname">pg_attribute</code></a>.<code class="structfield">attnum</code>)
+ </p>
+ <p>
+ If a table constraint (including foreign keys, but not constraint
+ triggers), list of the constrained columns
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">confkey</code> <code class="type">int2[]</code>
+ (references <a class="link" href="catalog-pg-attribute.html" title="51.7. pg_attribute"><code class="structname">pg_attribute</code></a>.<code class="structfield">attnum</code>)
+ </p>
+ <p>
+ If a foreign key, list of the referenced columns
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conpfeqop</code> <code class="type">oid[]</code>
+ (references <a class="link" href="catalog-pg-operator.html" title="51.34. pg_operator"><code class="structname">pg_operator</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ If a foreign key, list of the equality operators for PK = FK comparisons
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conppeqop</code> <code class="type">oid[]</code>
+ (references <a class="link" href="catalog-pg-operator.html" title="51.34. pg_operator"><code class="structname">pg_operator</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ If a foreign key, list of the equality operators for PK = PK comparisons
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conffeqop</code> <code class="type">oid[]</code>
+ (references <a class="link" href="catalog-pg-operator.html" title="51.34. pg_operator"><code class="structname">pg_operator</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ If a foreign key, list of the equality operators for FK = FK comparisons
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conexclop</code> <code class="type">oid[]</code>
+ (references <a class="link" href="catalog-pg-operator.html" title="51.34. pg_operator"><code class="structname">pg_operator</code></a>.<code class="structfield">oid</code>)
+ </p>
+ <p>
+ If an exclusion constraint, list of the per-column exclusion operators
+ </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
+ <code class="structfield">conbin</code> <code class="type">pg_node_tree</code>
+ </p>
+ <p>
+ If a check constraint, an internal representation of the
+ expression. (It's recommended to use
+ <code class="function">pg_get_constraintdef()</code> to extract the definition of
+ a check constraint.)
+ </p></td></tr></tbody></table></div></div><br class="table-break" /><p>
+ In the case of an exclusion constraint, <code class="structfield">conkey</code>
+ is only useful for constraint elements that are simple column references.
+ For other cases, a zero appears in <code class="structfield">conkey</code>
+ and the associated index must be consulted to discover the expression
+ that is constrained. (<code class="structfield">conkey</code> thus has the
+ same contents as <code class="structname">pg_index</code>.<code class="structfield">indkey</code> for the
+ index.)
+ </p><div class="note"><h3 class="title">Note</h3><p>
+ <code class="literal">pg_class.relchecks</code> needs to agree with the
+ number of check-constraint entries found in this table for each
+ relation.
+ </p></div></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navfooter"><hr></hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-collation.html" title="51.12. pg_collation">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html" title="Chapter 51. System Catalogs">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-conversion.html" title="51.14. pg_conversion">Next</a></td></tr><tr><td width="40%" align="left" valign="top">51.12. <code xmlns="http://www.w3.org/1999/xhtml" class="structname">pg_collation</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 13.4 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 51.14. <code xmlns="http://www.w3.org/1999/xhtml" class="structname">pg_conversion</code></td></tr></table></div></body></html> \ No newline at end of file