diff options
Diffstat (limited to 'doc/src/sgml/html/catalog-pg-constraint.html')
-rw-r--r-- | doc/src/sgml/html/catalog-pg-constraint.html | 206 |
1 files changed, 206 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..8d6737a --- /dev/null +++ b/doc/src/sgml/html/catalog-pg-constraint.html @@ -0,0 +1,206 @@ +<?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>53.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 Vsnapshot" /><link rel="prev" href="catalog-pg-collation.html" title="53.12. pg_collation" /><link rel="next" href="catalog-pg-conversion.html" title="53.14. pg_conversion" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">53.13. <code class="structname">pg_constraint</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-collation.html" title="53.12. pg_collation">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 53. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-conversion.html" title="53.14. pg_conversion">Next</a></td></tr></table><hr /></div><div class="sect1" id="CATALOG-PG-CONSTRAINT"><div class="titlepage"><div><div><h2 class="title" style="clear: both">53.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 + <a class="link" href="catalog-pg-attribute.html" title="53.7. pg_attribute"><code class="structname">pg_attribute</code></a> + catalog, not here. + </p><p> + User-defined constraint triggers (created with <a class="link" href="sql-createtrigger.html" title="CREATE TRIGGER"> + <code class="command">CREATE CONSTRAINT TRIGGER</code></a>) 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 53.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="53.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 be false only 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="53.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">oid</code>) + </p> + <p> + The table this constraint is on; zero 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="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>) + </p> + <p> + The domain this constraint is on; zero 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="53.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 zero + </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="53.13. pg_constraint"><code class="structname">pg_constraint</code></a>.<code class="structfield">oid</code>) + </p> + <p> + The corresponding constraint of the parent partitioned table, + if this is a constraint on a partition; else zero + </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="53.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 zero + </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="53.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="53.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="53.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="53.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="53.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">confdelsetcols</code> <code class="type">int2[]</code> + (references <a class="link" href="catalog-pg-attribute.html" title="53.7. pg_attribute"><code class="structname">pg_attribute</code></a>.<code class="structfield">attnum</code>) + </p> + <p> + If a foreign key with a <code class="literal">SET NULL</code> or <code class="literal">SET + DEFAULT</code> delete action, the columns that will be updated. + If null, all of the referencing columns will be updated. + </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="53.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 <a class="link" href="catalog-pg-index.html" title="53.26. pg_index"><code class="structname">pg_index</code></a>.<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 class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-collation.html" title="53.12. pg_collation">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-conversion.html" title="53.14. pg_conversion">Next</a></td></tr><tr><td width="40%" align="left" valign="top">53.12. <code class="structname">pg_collation</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.4 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 53.14. <code class="structname">pg_conversion</code></td></tr></table></div></body></html>
\ No newline at end of file |