-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalog-pg-constraint.html
More file actions
86 lines (86 loc) · 14.9 KB
/
catalog-pg-constraint.html
File metadata and controls
86 lines (86 loc) · 14.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?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@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" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 10.5文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="catalogs.html" title="第51章 システムカタログ">第51章 システムカタログ</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?title=version 10.5 catalog-pg-constraint.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-collation.html" title="51.12. pg_collation">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="第51章 システムカタログ">上へ</a></td><td width="60%" align="center">51.13. <code class="structname">pg_constraint</code></td><td width="20%" align="right"> <a accesskey="n" href="catalog-pg-conversion.html" title="51.14. pg_conversion">次へ</a></td></tr></table><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><span class="original">
The catalog <structname>pg_constraint</structname> 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 <structname>pg_attribute</>
catalog, not here.
</span><code class="structname">pg_constraint</code>カタログはテーブル上の検査制約、主キー制約、一意性制約、外部キー制約、排他制約を格納します
(列制約は特別扱いされていません。
全ての列制約は何らかのテーブル制約と同等です。)
非NULL制約はここではなく、<code class="structname">pg_attribute</code>カタログで示されます。
</p><p><span class="original">
User-defined constraint triggers (created with <command>CREATE CONSTRAINT
TRIGGER</>) also give rise to an entry in this table.
</span>(<code class="command">CREATE CONSTRAINT TRIGGER</code>で作成される)ユーザ定義の制約トリガもこのテーブルの項目の元になります。
</p><p><span class="original">
Check constraints on domains are stored here, too.
</span> ドメイン上の検査制約もここに格納されます。
</p><div class="table" id="id-1.10.4.15.6"><p class="title"><strong>表51.13 <code class="structname">pg_constraint</code>の列</strong></p><div class="table-contents"><span class="original">
<title><structname>pg_constraint</> Columns</title>
</span><table class="table" summary="pg_constraintの列" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th>名前</th><th>型</th><th>参照先</th><th>説明</th></tr></thead><tbody><tr><td><code class="structfield">oid</code></td><td><code class="type">oid</code></td><td> </td><td>行識別子(隠し属性です。明示的に選択しなければなりません)</td></tr><tr><td><code class="structfield">conname</code></td><td><code class="type">name</code></td><td> </td><td>制約名(一意である必要はありません)。</td></tr><tr><td><code class="structfield">connamespace</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-namespace.html" title="51.32. pg_namespace"><code class="structname">pg_namespace</code></a>.oid</code></td><td><span class="original">
The OID of the namespace that contains this constraint
</span> この制約を含む名前空間のOID。
</td></tr><tr><td><code class="structfield">contype</code></td><td><code class="type">char</code></td><td> </td><td><span class="original">
<literal>c</> = check constraint,
<literal>f</> = foreign key constraint,
<literal>p</> = primary key constraint,
<literal>u</> = unique constraint,
<literal>t</> = constraint trigger,
<literal>x</> = exclusion constraint
</span> <code class="literal">c</code> = 検査制約、
<code class="literal">f</code> = 外部キー制約、
<code class="literal">p</code> = 主キー制約、
<code class="literal">u</code> = 一意性制約、
<code class="literal">t</code> = 制約トリガ,
<code class="literal">x</code> = 排他制約
</td></tr><tr><td><code class="structfield">condeferrable</code></td><td><code class="type">bool</code></td><td> </td><td>制約は遅延可能かどうか?</td></tr><tr><td><code class="structfield">condeferred</code></td><td><code class="type">bool</code></td><td> </td><td>制約はデフォルトで遅延可能かどうか?</td></tr><tr><td><code class="structfield">convalidated</code></td><td><code class="type">bool</code></td><td> </td><td>制約が検証されているか?現時点では外部キーとチェック制約の場合のみ偽になる可能性があります。</td></tr><tr><td><code class="structfield">conrelid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="51.11. pg_class"><code class="structname">pg_class</code></a>.oid</code></td><td>この制約が存在しているテーブルです。テーブル制約でなければ0です。</td></tr><tr><td><code class="structfield">contypid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-type.html" title="51.62. pg_type"><code class="structname">pg_type</code></a>.oid</code></td><td>この制約が存在しているドメインです。ドメイン制約でなければ0です。</td></tr><tr><td><code class="structfield">conindid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="51.11. pg_class"><code class="structname">pg_class</code></a>.oid</code></td><td>一意性制約、主キー制約、外部キー制約、排他制約の場合、この制約をサポートするインデックス。
さもなくばゼロ。
</td></tr><tr><td><code class="structfield">confrelid</code></td><td><code class="type">oid</code></td><td><code class="literal"><a class="link" href="catalog-pg-class.html" title="51.11. pg_class"><code class="structname">pg_class</code></a>.oid</code></td><td>外部キーであれば、参照されるテーブルです。そうでなければ0です。</td></tr><tr><td><code class="structfield">confupdtype</code></td><td><code class="type">char</code></td><td> </td><td>外部キー更新アクションコード:
<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
</td></tr><tr><td><code class="structfield">confdeltype</code></td><td><code class="type">char</code></td><td> </td><td>外部キー削除アクションコード:
<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
</td></tr><tr><td><code class="structfield">confmatchtype</code></td><td><code class="type">char</code></td><td> </td><td>外部キーの一致型:
<code class="literal">f</code> = full,
<code class="literal">p</code> = partial,
<code class="literal">s</code> = simple
</td></tr><tr><td><code class="structfield">conislocal</code></td><td><code class="type">bool</code></td><td> </td><td> この制約はリレーションでローカルに定義されています。制約はローカルに定義されていて同時に継承されます。
</td></tr><tr><td><code class="structfield">coninhcount</code></td><td><code class="type">int4</code></td><td> </td><td>この制約がもつ直系の先祖の数。
先祖の数がゼロではない制約は削除や改名はできません。
</td></tr><tr><td><code class="structfield">connoinherit</code></td><td><code class="type">bool</code></td><td> </td><td>この制約はリレーションのためにローカルで定義されます。これは非継承制約です。
</td></tr><tr><td><code class="structfield">conkey</code></td><td><code class="type">int2[]</code></td><td><code class="literal"><a class="link" href="catalog-pg-attribute.html" title="51.7. pg_attribute"><code class="structname">pg_attribute</code></a>.attnum</code></td><td>テーブル制約(外部キーを含みますが制約トリガは含みません)であれば、その制約によって制約される列のリスト</td></tr><tr><td><code class="structfield">confkey</code></td><td><code class="type">int2[]</code></td><td><code class="literal"><a class="link" href="catalog-pg-attribute.html" title="51.7. pg_attribute"><code class="structname">pg_attribute</code></a>.attnum</code></td><td>外部キーであれば、参照される列のリスト</td></tr><tr><td><code class="structfield">conpfeqop</code></td><td><code class="type">oid[]</code></td><td><code class="literal"><a class="link" href="catalog-pg-operator.html" title="51.34. pg_operator"><code class="structname">pg_operator</code></a>.oid</code></td><td>外部キーであれば、PK = FKの比較のための同値演算子のリスト</td></tr><tr><td><code class="structfield">conppeqop</code></td><td><code class="type">oid[]</code></td><td><code class="literal"><a class="link" href="catalog-pg-operator.html" title="51.34. pg_operator"><code class="structname">pg_operator</code></a>.oid</code></td><td>外部キーであれば、PK = PKの比較のための同値演算子のリスト</td></tr><tr><td><code class="structfield">conffeqop</code></td><td><code class="type">oid[]</code></td><td><code class="literal"><a class="link" href="catalog-pg-operator.html" title="51.34. pg_operator"><code class="structname">pg_operator</code></a>.oid</code></td><td>外部キーであれば、FK = FKの比較のための同値演算子のリスト</td></tr><tr><td><code class="structfield">conexclop</code></td><td><code class="type">oid[]</code></td><td><code class="literal"><a class="link" href="catalog-pg-operator.html" title="51.34. pg_operator"><code class="structname">pg_operator</code></a>.oid</code></td><td>排他制約の場合、列単位の排他演算子のリスト。
</td></tr><tr><td><code class="structfield">conbin</code></td><td><code class="type">pg_node_tree</code></td><td> </td><td>検査制約であれば、式の内部表現形式</td></tr><tr><td><code class="structfield">consrc</code></td><td><code class="type">text</code></td><td> </td><td>検査制約であれば、人間が見てわかる形式の式</td></tr></tbody></table></div></div><br class="table-break" /><p><span class="original">
In the case of an exclusion constraint, <structfield>conkey</structfield>
is only useful for constraint elements that are simple column references.
For other cases, a zero appears in <structfield>conkey</structfield>
and the associated index must be consulted to discover the expression
that is constrained. (<structfield>conkey</structfield> thus has the
same contents as <structname>pg_index</>.<structfield>indkey</> for the
index.)
</span>排他制約の場合、単純な列参照である制約要素でのみ<code class="structfield">conkey</code>が有用です。
その他の場合、<code class="structfield">conkey</code>はゼロであり、関連するインデックスは制約される式を調査して見つけなければなりません。
(したがってインデックスでは<code class="structfield">conkey</code>は<code class="structname">pg_index</code>.<code class="structfield">indkey</code>の内容と同じものを持ちます。)
</p><div class="note"><h3 class="title">注記</h3><p><span class="original">
<structfield>consrc</structfield> is not updated when referenced objects
change; for example, it won't track renaming of columns. Rather than
relying on this field, it's best to use <function>pg_get_constraintdef()</>
to extract the definition of a check constraint.
</span><code class="structfield">consrc</code>は参照されているオブジェクトが変更されても更新されません。
例えば列名の変更を追跡しません。
検査制約を引き出すためには、このフィールドに信頼を寄せるよりも<code class="function">pg_get_constraintdef()</code>を使うのが最善です。
</p></div><div class="note"><h3 class="title">注記</h3><p><span class="original">
<literal>pg_class.relchecks</literal> needs to agree with the
number of check-constraint entries found in this table for each
relation.
</span><code class="literal">pg_class.relchecks</code>はそれぞれのリレーションに対してこのテーブルで検出された検査制約の項目数と一致しなければなりません。
</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">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-conversion.html">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">51.12. <code class="structname">pg_collation</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">ホーム</a></td><td width="40%" align="right" valign="top"> 51.14. <code class="structname">pg_conversion</code></td></tr></table></div></body></html>