-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalog-pg-depend.html
More file actions
297 lines (295 loc) · 26.4 KB
/
catalog-pg-depend.html
File metadata and controls
297 lines (295 loc) · 26.4 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<?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>52.18. pg_depend</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-default-acl.html" title="52.17. pg_default_acl" /><link rel="next" href="catalog-pg-description.html" title="52.19. pg_description" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body id="docContent" class="container-fluid col-10"><div class="other_version"><a href="https://www.postgresql.jp/document/">バージョンごとのドキュメント一覧</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 18.3文書</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="第52章 システムカタログ">第52章 システムカタログ</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?template=bug_report.yml&what-happened=version 18.3 : catalog-pg-depend.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalog-pg-default-acl.html" title="52.17. pg_default_acl">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="第52章 システムカタログ">上へ</a></td><td width="60%" align="center">52.18. <code class="structname">pg_depend</code></td><td width="20%" align="right"> <a accesskey="n" href="catalog-pg-description.html" title="52.19. pg_description">次へ</a></td></tr></table><hr /></div><div class="sect1" id="CATALOG-PG-DEPEND"><div class="titlepage"><div><div><h2 class="title" style="clear: both">52.18. <code class="structname">pg_depend</code> <a href="#CATALOG-PG-DEPEND" class="id_link">#</a></h2></div></div></div><a id="id-1.10.4.20.2" class="indexterm"></a><p>
<span class="original">
The catalog <structname>pg_depend</structname> records the dependency
relationships between database objects. This information allows
<command>DROP</command> commands to find which other objects must be dropped
by <command>DROP CASCADE</command> or prevent dropping in the <command>DROP
RESTRICT</command> case.
</span>
<code class="structname">pg_depend</code>カタログは、データベースオブジェクト間の依存関係を記録します。
この情報によって<code class="command">DROP</code>コマンドが、他のどのオブジェクトを<code class="command">DROP CASCADE</code>で削除する必要があるか、また、<code class="command">DROP RESTRICT</code>で削除を防止するかの場合を判断します。
</p><p>
<span class="original">
See also <link linkend="catalog-pg-shdepend"><structname>pg_shdepend</structname></link>,
which performs a similar function for dependencies involving objects
that are shared across a database cluster.
</span>
<a class="link" href="catalog-pg-shdepend.html" title="52.48. pg_shdepend"><code class="structname">pg_shdepend</code></a>も参照してください。
これはデータベースクラスタ間で共有されるオブジェクトの依存関係に対する似たような機能を持っています。
</p><div class="table" id="id-1.10.4.20.5"><p class="title"><strong>表52.18 <code class="structname">pg_depend</code>の列</strong></p><div class="table-contents"><span class="original">
<title><structname>pg_depend</structname> Columns</title>
</span><table class="table" summary="pg_dependの列" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
<span class="original">
Column Type
</span>
列 型
</p>
<p>
<span class="original">
Description
</span>
説明
</p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">classid</code> <code class="type">oid</code>
<span class="original">
(references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
</span>
(参照先 <a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">oid</code>)
</p>
<p>
<span class="original">
The OID of the system catalog the dependent object is in
</span>
依存するオブジェクトが存在するシステムカタログのOID
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">objid</code> <code class="type">oid</code>
<span class="original">
(references any OID column)
</span>
(いずれかのOID列)
</p>
<p>
<span class="original">
The OID of the specific dependent object
</span>
依存する特定のオブジェクトのOID
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">objsubid</code> <code class="type">int4</code>
</p>
<p>
<span class="original">
For a table column, this is the column number (the
<structfield>objid</structfield> and <structfield>classid</structfield> refer to the
table itself). For all other object types, this column is
zero.
</span>
テーブル列の場合、これは列番号です(<code class="structfield">objid</code>と<code class="structfield">classid</code>はテーブル自身を参照します)。
他のすべての種類のオブジェクトでは、この列はゼロです。
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">refclassid</code> <code class="type">oid</code>
<span class="original">
(references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>)
</span>
(参照先 <a class="link" href="catalog-pg-class.html" title="52.11. pg_class"><code class="structname">pg_class</code></a>.<code class="structfield">oid</code>)
</p>
<p>
<span class="original">
The OID of the system catalog the referenced object is in
</span>
参照されるオブジェクトが存在するシステムカタログのOID
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">refobjid</code> <code class="type">oid</code>
<span class="original">
(references any OID column)
</span>
(いずれかのOID列)
</p>
<p>
<span class="original">
The OID of the specific referenced object
</span>
特定の参照されるオブジェクトのOID
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">refobjsubid</code> <code class="type">int4</code>
</p>
<p>
<span class="original">
For a table column, this is the column number (the
<structfield>refobjid</structfield> and <structfield>refclassid</structfield> refer
to the table itself). For all other object types, this column
is zero.
</span>
テーブル列の場合、これは列番号です(<code class="structfield">refobjid</code>と<code class="structfield">refclassid</code>はテーブル自身を参照します)。
他のすべての種類のオブジェクトでは、この列はゼロです。
</p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
<code class="structfield">deptype</code> <code class="type">char</code>
</p>
<p>
<span class="original">
A code defining the specific semantics of this dependency relationship; see text
</span>
この依存関係の特定のセマンティクスを定義するコード(後述)
</p></td></tr></tbody></table></div></div><br class="table-break" /><p>
<span class="original">
In all cases, a <structname>pg_depend</structname> entry indicates that the
referenced object cannot be dropped without also dropping the dependent
object. However, there are several subflavors identified by
<structfield>deptype</structfield>:
</span>
すべての場合において、<code class="structname">pg_depend</code>エントリは依存するオブジェクトも削除しない限り、参照されるオブジェクトを削除できないことを示します。
もっとも、<code class="structfield">deptype</code>によって指定される以下のようないくつかのオプションもあります。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="symbol">DEPENDENCY_NORMAL</code> (<code class="literal">n</code>)</span></dt><dd><p>
<span class="original">
A normal relationship between separately-created objects. The
dependent object can be dropped without affecting the
referenced object. The referenced object can only be dropped
by specifying <literal>CASCADE</literal>, in which case the dependent
object is dropped, too. Example: a table column has a normal
dependency on its data type.
</span>
個別に作成されたオブジェクト間の通常の関係です。
依存するオブジェクトは参照されるオブジェクトに影響を与えずに削除できます。
参照されるオブジェクトは<code class="literal">CASCADE</code>を指定することによってのみ削除できます。
この場合は依存するオブジェクトも削除されます。
例:テーブルの列はそのデータ型に対して通常の依存関係を持ちます。
</p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_AUTO</code> (<code class="literal">a</code>)</span></dt><dd><p>
<span class="original">
The dependent object can be dropped separately from the
referenced object, and should be automatically dropped
(regardless of <literal>RESTRICT</literal> or <literal>CASCADE</literal>
mode) if the referenced object is dropped. Example: a named
constraint on a table is made auto-dependent on the table, so
that it will go away if the table is dropped.
</span>
依存するオブジェクトは参照されるオブジェクトから独立して削除できます。
そして、参照されるオブジェクトが削除される時は(<code class="literal">RESTRICT</code>もしくは<code class="literal">CASCADE</code>モードに関わりなく)依存するオブジェクトも自動的に削除されなければなりません。
例:テーブル上の名前付き制約はテーブル上に自動設定されているため、テーブルが削除されるとなくなります。
</p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_INTERNAL</code> (<code class="literal">i</code>)</span></dt><dd><p>
<span class="original">
The dependent object was created as part of creation of the
referenced object, and is really just a part of its internal
implementation. A direct <command>DROP</command> of the dependent
object will be disallowed outright (we'll tell the user to issue
a <command>DROP</command> against the referenced object, instead).
A <command>DROP</command> of the referenced object will result in
automatically dropping the dependent object
whether <literal>CASCADE</literal> is specified or not. If the
dependent object has to be dropped due to a dependency on some other
object being removed, its drop is converted to a drop of the referenced
object, so that <literal>NORMAL</literal> and <literal>AUTO</literal>
dependencies of the dependent object behave much like they were
dependencies of the referenced object.
Example: a view's <literal>ON SELECT</literal> rule is made
internally dependent on the view, preventing it from being dropped
while the view remains. Dependencies of the rule (such as tables it
refers to) act as if they were dependencies of the view.
</span>
依存するオブジェクトは参照されるオブジェクトの作成時に作成されたもので、実際には内部実装の一部に過ぎません。
依存するオブジェクトに対して<code class="command">DROP</code>コマンドを直接的に実行できません
(その代わりに、参照されるオブジェクトに対して<code class="command">DROP</code>を実行するように指示されます)。
参照されるオブジェクトに<code class="command">DROP</code>を実行すると、<code class="literal">CASCADE</code>が指定されているかどうかに関わらず、依存するオブジェクトも削除されます。
削除されるオブジェクトへの依存関係で依存しているオブジェクトを削除しなければらない場合、その削除は参照されるオブジェクトの削除に変換されます。
ですから依存しているオブジェクトの<code class="literal">NORMAL</code>と<code class="literal">AUTO</code>依存関係は、参照されるオブジェクトの依存関係に非常に似通った振る舞いをします。
例:ビューの<code class="literal">ON SELECT</code>ルールがビューに依存して内部的に作られ、ビューが存在する限り削除されることを防ぎます。
ルールの依存関係(たとえばそれが参照するテーブル)はビューの依存関係であるかのように振る舞います。
</p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_PARTITION_PRI</code> (<code class="literal">P</code>)<br /></span><span class="term"><code class="symbol">DEPENDENCY_PARTITION_SEC</code> (<code class="literal">S</code>)</span></dt><dd><p>
<span class="original">
The dependent object was created as part of creation of the
referenced object, and is really just a part of its internal
implementation; however, unlike <literal>INTERNAL</literal>,
there is more than one such referenced object. The dependent object
must not be dropped unless at least one of these referenced objects
is dropped; if any one is, the dependent object should be dropped
whether or not <literal>CASCADE</literal> is specified. Also
unlike <literal>INTERNAL</literal>, a drop of some other object
that the dependent object depends on does not result in automatic
deletion of any partition-referenced object. Hence, if the drop
does not cascade to at least one of these objects via some other
path, it will be refused. (In most cases, the dependent object
shares all its non-partition dependencies with at least one
partition-referenced object, so that this restriction does not
result in blocking any cascaded delete.)
Primary and secondary partition dependencies behave identically
except that the primary dependency is preferred for use in error
messages; hence, a partition-dependent object should have one
primary partition dependency and one or more secondary partition
dependencies.
Note that partition dependencies are made in addition to, not
instead of, any dependencies the object would normally have. This
simplifies <command>ATTACH/DETACH PARTITION</command> operations:
the partition dependencies need only be added or removed.
Example: a child partitioned index is made partition-dependent
on both the partition table it is on and the parent partitioned
index, so that it goes away if either of those is dropped, but
not otherwise. The dependency on the parent index is primary,
so that if the user tries to drop the child partitioned index,
the error message will suggest dropping the parent index instead
(not the table).
</span>
依存するオブジェクトは参照されるオブジェクトの生成の一環で作成され、実際にはこれは内部的な実装の一部に過ぎません。
しかし、<code class="literal">INTERNAL</code>とは違って複数の参照されるオブジェクトが存在します。
参照されているオブジェクトの少なくとも1つが削除されない限り、依存するオブジェクトは削除されてはいけません。
もし参照されているオブジェクトの一つが削除されたら、<code class="literal">CASCADE</code>が指定されているかどうかに関わらず、依存しているオブジェクトは削除されるべきです。
また、<code class="literal">INTERNAL</code>とは違って、依存オブジェクトが依存しているオブジェクトを削除してもパーティション参照オブジェクトを自動的に削除することにはなりません。
ですからその削除処理によって他の経路でこれらのオブジェクトの少なくとも1つに連鎖波及しない限り、削除は拒否されます。
(たいていの場合、依存するオブジェクトはすべての非パーティション依存関係を、少なくとも1つのパーティション参照オブジェクトと共有するので、この制限によって連鎖削除をブロックすることにはなりません。)
エラーメッセージで優先的に主パーティションが使われることを除くと、主および二次パーティション依存関係は同じように振る舞います。
よって、パーティション依存オブジェクトは一つの主パーティション依存関係と1つ以上の二次パーティション依存関係を持つはずです。
パーティション依存関係は、オブジェクトが通常持っている依存関係に加えて作成されるのであり、それを置き換えるものではないことに注意してください。
これによって<code class="command">ATTACH/DETACH PARTITION</code>操作が簡単になります。
パーティション依存関係は追加されるか削除されるかのどちらかになります。
例:子パーティションインデックスは、それが作成されているパーティションテーブルと親パーティションインデックスの両方にパーティション依存します。
ですから、このどちらかが削除されると削除されますが、それ以外の場合には削除されません。
親インデックスへの依存関係は主なので、ユーザが子パーティションインデックスを削除しようとすると、エラーメッセージは(テーブルではなく)親インデックスを削除するように示唆します。
</p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_EXTENSION</code> (<code class="literal">e</code>)</span></dt><dd><p>
<span class="original">
The dependent object is a member of the <firstterm>extension</firstterm> that is
the referenced object (see
<link linkend="catalog-pg-extension"><structname>pg_extension</structname></link>).
The dependent object can be dropped only via
<link linkend="sql-dropextension"><command>DROP EXTENSION</command></link> on the referenced object.
Functionally this dependency type acts the same as
an <literal>INTERNAL</literal> dependency, but it's kept separate for
clarity and to simplify <application>pg_dump</application>.
</span>
依存するオブジェクトは参照されるオブジェクトの<em class="firstterm">拡張</em>のメンバです(<a class="link" href="catalog-pg-extension.html" title="52.22. pg_extension"><code class="structname">pg_extension</code></a>参照)。
依存するオブジェクトは参照されるオブジェクトに対する<a class="link" href="sql-dropextension.html" title="DROP EXTENSION"><code class="command">DROP EXTENSION</code></a>経由でのみ削除できます。
機能的にはこの種類の依存関係は<code class="literal">INTERNAL</code>依存関係と同様に動作しますが、明確さと<span class="application">pg_dump</span>を単純化するために別々に保持されます。
</p></dd><dt><span class="term"><code class="symbol">DEPENDENCY_AUTO_EXTENSION</code> (<code class="literal">x</code>)</span></dt><dd><p>
<span class="original">
The dependent object is not a member of the extension that is the
referenced object (and so it should not be ignored
by <application>pg_dump</application>), but it cannot function
without the extension and should be auto-dropped if the extension is.
The dependent object may be dropped on its own as well.
Functionally this dependency type acts the same as
an <literal>AUTO</literal> dependency, but it's kept separate for
clarity and to simplify <application>pg_dump</application>.
</span>
依存するオブジェクトは参照されるオブジェクトの拡張のメンバではありません(そしてそれゆえ<span class="application">pg_dump</span>によって無視されません)が、拡張なしに機能することが出来ず、拡張自体が削除される時に自動的に削除されるでしょう。
依存するオブジェクトは、同様にそれ自身で削除されるかもしれません。
機能的にはこの種類の依存関係は<code class="literal">AUTO</code>依存関係と同様に動作しますが、明確さと<span class="application">pg_dump</span>を単純化するために別々に保持されます。
</p></dd></dl></div><p>
<span class="original">
Other dependency flavors might be needed in future.
</span>
将来的に、他の依存関係のオプションが必要になる可能性があります。
</p><p>
<span class="original">
Note that it's quite possible for two objects to be linked by more than
one <structname>pg_depend</structname> entry. For example, a child
partitioned index would have both a partition-type dependency on its
associated partition table, and an auto dependency on each column of
that table that it indexes. This sort of situation expresses the union
of multiple dependency semantics. A dependent object can be dropped
without <literal>CASCADE</literal> if any of its dependencies satisfies
its condition for automatic dropping. Conversely, all the
dependencies' restrictions about which objects must be dropped together
must be satisfied.
</span>
2つのオブジェクトが複数の<code class="structname">pg_depend</code>エントリでリンクされていることは十分ありえます。
たとえば子パーティションインデックスは、パーティションテーブルに対してパーティション型依存関係を持ち、更にインデックスが貼ってあるテーブルの列に自動依存関係を持ちます。
この種の状況は、複数の依存関係セマンティクスの和で表現されます。
自動削除の条件をこの依存関係の一つが満たすならば依存するオブジェクトは<code class="literal">CASCADE</code>なしに削除できます。
逆に、どのオブジェクトが一緒に削除されなければならないかに関するすべての依存関係の制限は満足されなければなりません。
</p><p>
<span class="original">
Most objects created during <application>initdb</application> are
considered <quote>pinned</quote>, which means that the system itself
depends on them. Therefore, they are never allowed to be dropped.
Also, knowing that pinned objects will not be dropped, the dependency
mechanism doesn't bother to make <structname>pg_depend</structname>
entries showing dependencies on them. Thus, for example, a table
column of type <type>numeric</type> notionally has
a <literal>NORMAL</literal> dependency on the <type>numeric</type>
data type, but no such entry actually appears
in <structname>pg_depend</structname>.
</span>
<span class="application">initdb</span>中に作成されたほとんどのオブジェクトは<span class="quote">「<span class="quote">固定(pinned)</span>」</span>とみなされます。
これは、システム自体がオブジェクトに依存していることを意味します。
したがって、オブジェクトを削除することは決してできません。
また、固定されたオブジェクトが削除されないことを知っているため、依存メカニズムはオブジェクトへの依存関係を示す<code class="structname">pg_depend</code>エントリをわざわざ作成する必要がありません。
ですから、例えば、<code class="type">numeric</code>型のテーブル列は理論上<code class="type">numeric</code>データ型に<code class="literal">NORMAL</code>依存しますが、そのようなエントリは実際には<code class="structname">pg_depend</code>にはありません。
</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalog-pg-default-acl.html" title="52.17. pg_default_acl">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html" title="第52章 システムカタログ">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-description.html" title="52.19. pg_description">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">52.17. <code class="structname">pg_default_acl</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.3文書">ホーム</a></td><td width="40%" align="right" valign="top"> 52.19. <code class="structname">pg_description</code></td></tr></table></div></body></html>