doc-exports/docs/dws/dev/dws_04_0580.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

249 lines
28 KiB
HTML

<a name="EN-US_TOPIC_0000001233761851"></a><a name="EN-US_TOPIC_0000001233761851"></a>
<h1 class="topictitle1">PG_CONSTRAINT</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001233761851__a2fe20ac2896c4203a319821a2a7c0808"><strong id="EN-US_TOPIC_0000001233761851__b19501136172515">PG_CONSTRAINT</strong> records check, primary key, unique, and foreign key constraints on the tables.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233761851__t9dfb7fb1e1914506ac2b49f6a60f1949" frame="border" border="1" rules="all"><caption><b>Table 1 </b>PG_CONSTRAINT columns</caption><thead align="left"><tr id="EN-US_TOPIC_0000001233761851__ra9126c3047214046853c6b130c41d308"><th align="left" class="cellrowborder" valign="top" width="25.77%" id="mcps1.3.2.2.4.1.1"><p id="EN-US_TOPIC_0000001233761851__a0e8957df9cea41928e5d8d246232b031"><strong id="EN-US_TOPIC_0000001233761851__b84235270691445">Name</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.73%" id="mcps1.3.2.2.4.1.2"><p id="EN-US_TOPIC_0000001233761851__af23d58ee01354cb2bec0f70ec1bec9ff">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.49999999999999%" id="mcps1.3.2.2.4.1.3"><p id="EN-US_TOPIC_0000001233761851__af5d0d4af25c1492e9103ab762a5645b8">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001233761851__rc6073c2f54b44a838891c3357275d709"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__aa3b67f80a07c41df98f2976de3418e71">conname</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a83c70f624f7d415fb7306136e76c1b42">name</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a7538ffb79b9c43e883498df5aee9958e">Constraint name (not necessarily unique)</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rcad33820e4534cb49da2013e2003dac2"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a4632461108654c2499b4d7f2d538b78b">connamespace</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__aab54eb7a8a414ba09a7ec8e648f2a74b">oid</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a695588ed9daa44e18e685254df05e587">OID of the namespace that contains the constraint</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rf0f6ee68f4e1434a82822299aeb18adc"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__ad4b9577480d64ee98c72a7fa8b993a5f">contype</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a287f7f04c2e647ea904e3101b1cfd7c7">"char"</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><ul id="EN-US_TOPIC_0000001233761851__ue1df4cd44b0a4ff3974e540c7fc140ca"><li id="EN-US_TOPIC_0000001233761851__lac63e24f4da14682bcb99223ddc8ead6"><strong id="EN-US_TOPIC_0000001233761851__b18615184903911">c</strong> indicates check constraints.</li><li id="EN-US_TOPIC_0000001233761851__l601795c8e5b94f7a9fdaefeb9e120c4c"><strong id="EN-US_TOPIC_0000001233761851__b5615134983911">f</strong> indicates foreign key constraints.</li><li id="EN-US_TOPIC_0000001233761851__l2d697a3c62494edf8ebd8d98b84e4ad5"><strong id="EN-US_TOPIC_0000001233761851__b1761514497391">p</strong> indicates primary key constraints.</li><li id="EN-US_TOPIC_0000001233761851__lfc161acd9623475890ca6736163191a1"><strong id="EN-US_TOPIC_0000001233761851__b1061624911394">u</strong> indicates unique constraints.</li><li id="EN-US_TOPIC_0000001233761851__li144817312203"><strong id="EN-US_TOPIC_0000001233761851__b977553305717">t</strong> indicates trigger constraints.</li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rd5d1b8e7b263473fa3476297bca8ffaf"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a2b39f4f8145844d7a204f43dbd0bc968">condeferrable</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a5c3f6fcde52d49ecba69a2e9420b3629"><span id="EN-US_TOPIC_0000001233761851__text1912115813112">boolean</span></p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a50ea0ae215274de2a4458424fdc01aab">Whether the constraint can be deferrable</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r0fd3f0926ee54f5d967e89e68a03532c"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a6fdc1dc9a9bf40ab9de85a9c6d8c89f9">condeferred</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a2abfc15b7f1449b3bf935b50f1c7c373"><span id="EN-US_TOPIC_0000001233761851__text1779365963117">boolean</span></p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a3765984c90ef4358af8e3bf7ccf51742">Whether the constraint can be deferrable by default</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r92df9efc1ba842f99c30d0a1b56d60de"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a62562a186e3e4828aa2314835756c42d">convalidated</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__ad02b76a3e47748daaa206dde6934e8ce"><span id="EN-US_TOPIC_0000001233761851__text15682014320">boolean</span></p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a0646e4fd36d342ac9e47c3550422acb6">Whether the constraint is valid Currently, only foreign key and check constraints can be set to false.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r27732285242146a5a1a9ce103ee77454"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a586049c2e8024ee699a4fd78e4776dae">conrelid</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a98029663a1bf4427b86964266475be54">oid</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__ac0464615b560477eb1185c6291b67255">Table containing this constraint. The value is <strong id="EN-US_TOPIC_0000001233761851__b842352706193419">0</strong> if it is not a table constraint.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rd365c310a4d84abfa61e4b9b98f242f3"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__aa50f1b5f1821453ea946cc32b52dac56">contypid</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a3baf14ee089343d786f80e66de96371e">oid</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__ad5c03c6532a44f109bd296dcff904b74">Domain containing this constraint. The value is <strong id="EN-US_TOPIC_0000001233761851__b842352706193422">0</strong> if it is not a domain constraint.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rf98cd93ac19d4af4814c2e97a7700432"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a21fdb1560b4f4f22aca6d74155aad2c6">conindid</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a3f5c2b04abbf43d797c0fc886f2038e2">oid</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a862815bc2d2f420fa326091bdd062bde">ID of the index associated with the constraint</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r6af0219f0d494b8aa9a5f6d359589576"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__ab594444fb92c4af88038e0ffc84456eb">confrelid</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a8386cbfd4f0f4e0088118caf0b9578d7">oid</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__aa946a40aaba24c1f97dbf4afaa568d38">Referenced table if this constraint is a foreign key; otherwise, the value is <strong id="EN-US_TOPIC_0000001233761851__b842352706193430">0</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r90d417cb929448cd89b603074b05c214"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__ac79343c484ec426eb6f7b85003cda94e">confupdtype</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a0140f2f289fd4f0d9c97d3f4530c053c">"char"</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a158e9275fbb0401a9bc4137e9a25c096">Foreign key update action code</p>
<ul id="EN-US_TOPIC_0000001233761851__u8097ee50234446a28f1c5742bd2af0ce"><li id="EN-US_TOPIC_0000001233761851__l9bb19d0138ae4684a6da5f642bb27af0"><strong id="EN-US_TOPIC_0000001233761851__b36181949163913">a</strong> indicates no action.</li><li id="EN-US_TOPIC_0000001233761851__l0f95e736682e4753ae15796d1fd7737b"><strong id="EN-US_TOPIC_0000001233761851__b16191497397">r</strong> indicates restriction.</li><li id="EN-US_TOPIC_0000001233761851__le02356de596c4a51903013048a9bda8a"><strong id="EN-US_TOPIC_0000001233761851__b761916491399">c</strong> indicates cascading.</li><li id="EN-US_TOPIC_0000001233761851__l8dda0449d475429d9b7075462f1685be"><strong id="EN-US_TOPIC_0000001233761851__b1061911492398">n</strong> indicates that the parameter is set to null.</li><li id="EN-US_TOPIC_0000001233761851__l83a1bf85ee8a49a1b6c016b896745d5c"><strong id="EN-US_TOPIC_0000001233761851__b9620164993911">d</strong> indicates that the default value is used.</li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r6e8262b5507146bcaf99773a009400b2"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__ace679b189c7e4d3db70341cd6bba9021">confdeltype</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a8ca4ce82373342678f0c540c0bf15fca">"char"</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a266e48a89d98427cb3bcc5182cedabe7">Foreign key deletion action code</p>
<ul id="EN-US_TOPIC_0000001233761851__u1bb1143b7b8b488496f95f7a92f5c1ea"><li id="EN-US_TOPIC_0000001233761851__la85c7949a48340bda305f8f5b58ed4ca"><strong id="EN-US_TOPIC_0000001233761851__b162054917393">a</strong> indicates no action.</li><li id="EN-US_TOPIC_0000001233761851__lf8ad958880804c7d835853b909db4d03"><strong id="EN-US_TOPIC_0000001233761851__b1862118492396">r</strong> indicates restriction.</li><li id="EN-US_TOPIC_0000001233761851__l3c0bc7dada6c4968b80b3036f3d7ece7"><strong id="EN-US_TOPIC_0000001233761851__b15621184911393">c</strong> indicates cascading.</li><li id="EN-US_TOPIC_0000001233761851__l7840d22729b34403b676cb04ec370ca2"><strong id="EN-US_TOPIC_0000001233761851__b136211749133918">n</strong> indicates that the parameter is set to null.</li><li id="EN-US_TOPIC_0000001233761851__l2364e9bdd4a248009ade28ecda044b03"><strong id="EN-US_TOPIC_0000001233761851__b1862274933912">d</strong> indicates that the default value is used.</li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r1e1f0d0d211348e087ac239b8aaa3a81"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a8123393e039d44bf999f066952c84d5d">confmatchtype</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a011ab2b8ca50479086c6a1794c227196">"char"</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a7077099c56954fcbbfdcbc5fae392bad">Foreign key match type</p>
<ul id="EN-US_TOPIC_0000001233761851__ua6e03edd07cc435c9cbd6fc03ad8f487"><li id="EN-US_TOPIC_0000001233761851__lb1ac32b13c3a47d49dab1c3677397a92"><strong id="EN-US_TOPIC_0000001233761851__b6622184983916">f</strong> indicates full match.</li><li id="EN-US_TOPIC_0000001233761851__l512c73d0f61e4b03b67c770b5e769d40"><strong id="EN-US_TOPIC_0000001233761851__b12623144910397">p</strong> indicates partial match.</li><li id="EN-US_TOPIC_0000001233761851__ld99091e2d27542419aa35e8155847d4e"><strong id="EN-US_TOPIC_0000001233761851__b1062334919394">u</strong> indicates simple match (not specified).</li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r4f662477d7d54640ae0b00c2beee47af"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__aef6b51a1243b4fee998d0ad439bb168d">conislocal</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a937beffa939144c3be98e073162190f8"><span id="EN-US_TOPIC_0000001233761851__text169152110327">boolean</span></p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a83c03c84fdae4fbd971c7064d7ae5917">Whether the local constraint is defined for the relationship</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rb57869873abc4c7a9def24e5aecadd5a"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__ab78e596a50134f01baf5c52c405973e2">coninhcount</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a7525f5d74257448382abc9028e9b5e6a">integer</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a91bc433956dd4103a609a90ffbb2b493">Number of direct inheritance parent tables this constraint has. When the number is not <strong id="EN-US_TOPIC_0000001233761851__b842352706162925">0</strong>, the constraint cannot be deleted or renamed.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r5d184ed26c5240bab10f48ed1de43744"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a5f8a8bf39f3841f6ae38362f78fa5057">connoinherit</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a86c728d581264f78a9c6779326a756b5"><span id="EN-US_TOPIC_0000001233761851__text78754212320">boolean</span></p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a4a9aee9112b544b7a02a97c87ced05f3">Whether the constraint can be inherited</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r2bfa2de3ce9a4f498f46e501c15bcbb6"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a54403be4564d4197ad1aaf6523dcbddf">consoft</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a4ef8923057b84b10af7ed17ed30bfad7"><span id="EN-US_TOPIC_0000001233761851__text3940153183218">boolean</span></p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a22d4dd4af1a840a5b23d11c98c48440b">Whether the column indicates an informational constraint.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r9aaff59616f54a55beca4662c843bc05"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a23d0ba2c7b844975a7b72401ab137c8b">conopt</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a7704c759a2454798bbc16f0439bf6f11"><span id="EN-US_TOPIC_0000001233761851__text57651416329">boolean</span></p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a43ad820b17f249d5aa90b0577b7d7955">Whether you can use Informational Constraint to optimize the execution plan. </p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r20a6728dab704c6b9ca496847c30a0fc"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a58852f0d6cf341d9a6a57e5d22488b72">conkey</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a203cc41a7e6e41e7bcebf87459bd329b">smallint[]</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a2f277af7f1374ca99285846c76353a6e">Column list of the constrained control if this column is a table constraint</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rdbe70755bc4d4d8ebd61092478dfb270"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a5cc4287643884801aaaef674283070c9">confkey</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__ab5ebc2d18d864faaa3048cc168208f8a">smallint[]</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a80d7e23ca8924d15ab7d29c62aca32bd">List of referenced columns if this column is a foreign key</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r7f1bfac15bd346eab2ad7881200ba44e"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a17f8bc06813146329c2feba3406972e1">conpfeqop</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__ab6fde15a656540d6993024b1734eed9e">oid[]</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__aa75fbafb5dcc4476be273582c8b875a8">ID list of the equality operators for PK = FK comparisons if this column is a foreign key</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__ra7eda1ed21df485897b3a36b2335fac0"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__afb754ec6bce04b6d97a88cd1f11388fc">conppeqop</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a0271a5eff3704870b54bf931fbe2694e">oid[]</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a88cabfe9fa154fa7b5cbe3fd3926a12e">ID list of the equality operators for PK = PK comparisons if this column is a foreign key</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rb06dd993db844938aba108b891b083e9"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__acf4a0b0d6c824380b413675b2d280ead">conffeqop</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__aab7b7e2681584416b569bfd2e32a64f2">oid[]</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__af619d72a14f04c53bfc6ff46c23892f8">ID list of the equality operators for FK = FK comparisons if this column is a foreign key</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__r66b576584ce3470a867bdc8dbf36c7f2"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a1b9028c4008a422fb9860cf91baf2808">conexclop</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a49fe1ae783b9442f892dc2cb19597332">oid[]</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a09ec8062a3854879880d04d5a31dfc8d">ID list of the per-column exclusion operators if this column is an exclusion constraint</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rb17334f546e04823896ca878e0299393"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__a2dfd91617cce4709a02328fd259ec7de">conbin</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a48cfa2b816a54990b6faf4574282416c">pg_node_tree</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__a19de8f40048347329267b98f7a7dd953">Internal representation of the expression if this column is a check constraint</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761851__rb2a01c6b80f043f09838e84938e2e81b"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761851__aafb503dbb72644ddacff6551a7c54063">consrc</p>
</td>
<td class="cellrowborder" valign="top" width="16.73%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761851__a0961962356fb4654850b9be89c7ca4f3">text</p>
</td>
<td class="cellrowborder" valign="top" width="57.49999999999999%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761851__aa889f4692eaa4332915c7e31b2328643">Human-readable representation of the expression if this column is a check constraint</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="notice" id="EN-US_TOPIC_0000001233761851__n2e41dca9482548e2a2a3b33c7d955690"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="EN-US_TOPIC_0000001233761851__u5e65d4a5b57c4bc499b5f2fd9a321a69"><li id="EN-US_TOPIC_0000001233761851__l3255b997ef804e15961937e0e666d698"><strong id="EN-US_TOPIC_0000001233761851__b1627410401087">consrc</strong> is not updated when referenced objects change; for example, it will not track renaming of columns. Rather than relying on this field, it is best to use <strong id="EN-US_TOPIC_0000001233761851__b41742024181010">pg_get_constraintdef()</strong> to extract the definition of a check constraint.</li><li id="EN-US_TOPIC_0000001233761851__l4c125d4b4841450eb1ad379f8a85e78e"><strong id="EN-US_TOPIC_0000001233761851__b10560032193">pg_class.relchecks</strong> must be consistent with the number of check-constraint entries in this table for each relationship.</li></ul>
</div></div>
<div class="section" id="EN-US_TOPIC_0000001233761851__section96671447195"><h4 class="sectiontitle">Example</h4><p id="EN-US_TOPIC_0000001233761851__p1957518514196">Query whether a specified table has a primary key.</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001233761851__screen7206193511575"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span>
<span class="normal">14</span>
<span class="normal">15</span>
<span class="normal">16</span>
<span class="normal">17</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">t1</span>
<span class="p">(</span><span class="w"> </span>
<span class="w"> </span><span class="n">C_CUSTKEY</span><span class="w"> </span><span class="nb">BIGINT</span><span class="w"> </span><span class="p">,</span>
<span class="w"> </span><span class="n">C_NAME</span><span class="w"> </span><span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">25</span><span class="p">)</span><span class="w"> </span><span class="p">,</span>
<span class="w"> </span><span class="n">C_ADDRESS</span><span class="w"> </span><span class="nb">VARCHAR</span><span class="p">(</span><span class="mi">40</span><span class="p">)</span><span class="w"> </span><span class="p">,</span>
<span class="w"> </span><span class="n">C_NATIONKEY</span><span class="w"> </span><span class="nb">INT</span><span class="w"> </span><span class="p">,</span>
<span class="w"> </span><span class="n">C_PHONE</span><span class="w"> </span><span class="nb">CHAR</span><span class="p">(</span><span class="mi">15</span><span class="p">)</span><span class="w"> </span><span class="p">,</span>
<span class="w"> </span><span class="n">C_ACCTBAL</span><span class="w"> </span><span class="nb">DECIMAL</span><span class="p">(</span><span class="mi">15</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span><span class="w"> </span>
<span class="w"> </span><span class="k">CONSTRAINT</span><span class="w"> </span><span class="n">C_CUSTKEY_KEY</span><span class="w"> </span><span class="k">PRIMARY</span><span class="w"> </span><span class="k">KEY</span><span class="p">(</span><span class="n">C_CUSTKEY</span><span class="p">,</span><span class="n">C_NAME</span><span class="p">)</span>
<span class="p">)</span>
<span class="n">DISTRIBUTE</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">HASH</span><span class="p">(</span><span class="n">C_CUSTKEY</span><span class="p">,</span><span class="n">C_NAME</span><span class="p">);</span>
<span class="k">SELECT</span><span class="w"> </span><span class="n">conname</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_constraint</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="n">conrelid</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'t1'</span><span class="p">::</span><span class="n">regclass</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="n">contype</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'p'</span><span class="p">;</span>
<span class="w"> </span><span class="n">conname</span>
<span class="c1">---------------</span>
<span class="w"> </span><span class="n">c_custkey_key</span>
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0561.html">System Catalogs</a></div>
</div>
</div>