forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: luhuayi <luhuayi@huawei.com> Co-committed-by: luhuayi <luhuayi@huawei.com>
73 lines
8.1 KiB
HTML
73 lines
8.1 KiB
HTML
<a name="EN-US_TOPIC_0000001764491176"></a><a name="EN-US_TOPIC_0000001764491176"></a>
|
|
|
|
<h1 class="topictitle1">USER_CONSTRAINTS</h1>
|
|
<div id="body1551942823551"><p id="EN-US_TOPIC_0000001764491176__p819572174514"><strong id="EN-US_TOPIC_0000001764491176__b108311546201219">USER_CONSTRAINTS</strong> displays the table constraint information accessible to the current user.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001764491176__table2019514234513" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_row519610211455"><th align="left" class="cellrowborder" valign="top" width="25.77%" id="mcps1.3.2.1.4.1.1"><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p619610274515"><strong id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_b7247928743526">Column</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="19.97%" id="mcps1.3.2.1.4.1.2"><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p519620214517">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="54.26%" id="mcps1.3.2.1.4.1.3"><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p219611214455">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_row1919618214458"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.1.4.1.1 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p1719612220451">constraint_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.97%" headers="mcps1.3.2.1.4.1.2 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p01968234517">vcharacter varying(64)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.26%" headers="mcps1.3.2.1.4.1.3 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p640312320473">Constraint name</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_row219610217451"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.1.4.1.1 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p1528611044720">constraint_type</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.97%" headers="mcps1.3.2.1.4.1.2 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p2019616214519">Text</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.26%" headers="mcps1.3.2.1.4.1.3 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p19641255194710">Constraint type</p>
|
|
<ul id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_ul168201643185318"><li id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_li13820943155315"><strong id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_b12399163765414">C</strong>: Check constraint</li><li id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_li17821643105311"><strong id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_b590513386546">F</strong>: Foreign key constraint</li><li id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_li4821154313534"><strong id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_b1041314405542">P</strong>: Primary key constraint</li><li id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_li482184311537"><strong id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_b103401942165417">U</strong>: Unique constraint.</li></ul>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_row121965215453"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.1.4.1.1 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p819716264514">table_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.97%" headers="mcps1.3.2.1.4.1.2 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p2055164091615">character varying(64)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.26%" headers="mcps1.3.2.1.4.1.3 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p71972211451">Name of constraint-related table</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_row10197528456"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.1.4.1.1 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p195782422162">index_owner</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.97%" headers="mcps1.3.2.1.4.1.2 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p135866421168">character varying(64)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.26%" headers="mcps1.3.2.1.4.1.3 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p186404424817">Owner of constraint-related index (only for the unique constraint and primary key constraint)</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_row1249124174914"><td class="cellrowborder" valign="top" width="25.77%" headers="mcps1.3.2.1.4.1.1 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p11249841495">index_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="19.97%" headers="mcps1.3.2.1.4.1.2 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p1041814417161">character varying(64)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="54.26%" headers="mcps1.3.2.1.4.1.3 "><p id="EN-US_TOPIC_0000001764491176__en-us_topic_0000001764650480_p9249124144911">Name of constraint-related index (only for the unique constraint and primary key constraint)</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001764491176__section210310911541"><h4 class="sectiontitle">Example</h4><p id="EN-US_TOPIC_0000001764491176__p1957518514196">Query constraints on a specified table of the current user. Replace <strong id="EN-US_TOPIC_0000001764491176__b17409132817280">t1</strong> with the actual table name.</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001764491176__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></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">USER_CONSTRAINTS</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="k">table_name</span><span class="o">=</span><span class="s1">'t1'</span><span class="p">;</span>
|
|
<span class="w"> </span><span class="k">constraint_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">constraint_type</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">table_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">index_owner</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">index_name</span>
|
|
<span class="c1">-----------------+-----------------+------------+-------------+---------------</span>
|
|
<span class="w"> </span><span class="n">c_custkey_key</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">p</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">t1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">u1</span><span class="w"> </span><span class="o">|</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_0639.html">System Views</a></div>
|
|
</div>
|
|
</div>
|
|
|