-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbki.html
More file actions
89 lines (89 loc) · 12.7 KB
/
bki.html
File metadata and controls
89 lines (89 loc) · 12.7 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
<?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>第68章 システムカタログの宣言と初期内容</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="two-phase.html" title="67.4. 2相トランザクション" /><link rel="next" href="system-catalog-declarations.html" title="68.1. システムカタログの宣言ルール" /><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="internals.html" title="パート VII. 内部情報">パート VII. 内部情報</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 : bki.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="two-phase.html" title="67.4. 2相トランザクション">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="internals.html" title="パート VII. 内部情報">上へ</a></td><td width="60%" align="center">第68章 システムカタログの宣言と初期内容</td><td width="20%" align="right"> <a accesskey="n" href="system-catalog-declarations.html" title="68.1. システムカタログの宣言ルール">次へ</a></td></tr></table><hr /></div><div class="chapter" id="BKI"><div class="titlepage"><div><div><h2 class="title">第68章 システムカタログの宣言と初期内容</h2></div></div></div><div class="toc"><p><strong>目次</strong></p><dl class="toc"><dt><span class="sect1"><a href="system-catalog-declarations.html">68.1. システムカタログの宣言ルール</a></span></dt><dt><span class="sect1"><a href="system-catalog-initial-data.html">68.2. システムカタログ初期データ</a></span></dt><dd><dl><dt><span class="sect2"><a href="system-catalog-initial-data.html#SYSTEM-CATALOG-INITIAL-DATA-FORMAT">68.2.1. データファイル形式</a></span></dt><dt><span class="sect2"><a href="system-catalog-initial-data.html#SYSTEM-CATALOG-OID-ASSIGNMENT">68.2.2. OIDの割当</a></span></dt><dt><span class="sect2"><a href="system-catalog-initial-data.html#SYSTEM-CATALOG-OID-REFERENCES">68.2.3. OID参照検索</a></span></dt><dt><span class="sect2"><a href="system-catalog-initial-data.html#SYSTEM-CATALOG-AUTO-ARRAY-TYPES">68.2.4. 配列型の自動作成</a></span></dt><dt><span class="sect2"><a href="system-catalog-initial-data.html#SYSTEM-CATALOG-RECIPES">68.2.5. データファイルの編集方法</a></span></dt></dl></dd><dt><span class="sect1"><a href="bki-format.html">68.3. <acronym class="acronym">BKI</acronym>ファイル形式</a></span></dt><dt><span class="sect1"><a href="bki-commands.html">68.4. <acronym class="acronym">BKI</acronym>コマンド</a></span></dt><dt><span class="sect1"><a href="bki-structure.html">68.5. <acronym class="acronym">BKI</acronym>ファイルのブートストラップの構成</a></span></dt><dt><span class="sect1"><a href="bki-example.html">68.6. BKIの例</a></span></dt></dl></div><span class="original">
<title>System Catalog Declarations and Initial Contents</title>
</span><p>
<span class="original">
<productname>PostgreSQL</productname> uses many different system catalogs
to keep track of the existence and properties of database objects, such as
tables and functions. Physically there is no difference between a system
catalog and a plain user table, but the backend C code knows the structure
and properties of each catalog, and can manipulate it directly at a low
level. Thus, for example, it is inadvisable to attempt to alter the
structure of a catalog on-the-fly; that would break assumptions built into
the C code about how rows of the catalog are laid out. But the structure
of the catalogs can change between major versions.
</span>
<span class="productname">PostgreSQL</span>は、テーブルや関数のようなデータベースオブジェクトの存在の有無と特性を追跡するために、多くの異なるシステムカタログを使用します。
物理的な観点ではシステムカタログとユーザテーブルの間に違いはありませんが、バックエンドのCコードはそれぞれのカタログの構造と特性を把握しており、直接カタログを低レベルで操作することができます。
ですから、たとえばカタログの構造を思いつきで変更しようとするのはおすすめできません。そのことによって、Cのコードに組み込まれているカタログの行のレイアウトに関する前提を壊してしまうことになるからです。
とはいえ、カタログの構造はメジャーバージョン間で変更されることがあります。
</p><p>
<span class="original">
The structures of the catalogs are declared in specially formatted C
header files in the <filename>src/include/catalog/</filename> directory of
the source tree. For each catalog there is a header file
named after the catalog (e.g., <filename>pg_class.h</filename>
for <structname>pg_class</structname>), which defines the set of columns
the catalog has, as well as some other basic properties such as its OID.
</span>
カタログの構造は、ソースツリーの<code class="filename">src/include/catalog/</code>ディレクトリの中の特殊な形式のCヘッダファイルに宣言されています。
個々のカタログに対応して、カタログと同じ名前のヘッダファイルが存在し(たとえば、<code class="structname">pg_class</code>に対して<code class="filename">pg_class.h</code>というように)、カタログが持つ一連の列やOIDのような基本的な特性を定義しています。
</p><p>
<span class="original">
Many of the catalogs have initial data that must be loaded into them
during the <quote>bootstrap</quote> phase
of <application>initdb</application>, to bring the system up to a point
where it is capable of executing SQL commands. (For
example, <filename>pg_class.h</filename> must contain an entry for itself,
as well as one for each other system catalog and index.) This
initial data is kept in editable form in data files that are also stored
in the <filename>src/include/catalog/</filename> directory. For example,
<filename>pg_proc.dat</filename> describes all the initial rows that must
be inserted into the <structname>pg_proc</structname> catalog.
</span>
SQLコマンドを実行可能な状態にまでシステムを持っていくために、多くのカタログは<span class="application">initdb</span>の<span class="quote">「<span class="quote">bootstrap</span>」</span>フェーズで読み込まなければならない初期データを持っています。
(たとえば、<code class="filename">pg_class.h</code>は、他のシステムカタログとインデックス同様、自分自身のエントリを含んでいなければなりません。)
この初期データも、<code class="filename">src/include/catalog/</code>ディレクトリに格納されているデータファイル中に編集可能な形式で保存されています。
たとえば、<code class="filename">pg_proc.dat</code>は、<code class="structname">pg_proc</code>カタログに挿入されるべき初期の行を記述しています。
</p><p>
<span class="original">
To create the catalog files and load this initial data into them, a
backend running in bootstrap mode reads a <acronym>BKI</acronym>
(Backend Interface) file containing commands and initial data.
The <filename>postgres.bki</filename> file used in this mode is prepared
from the aforementioned header and data files, while building
a <productname>PostgreSQL</productname> distribution, by a Perl script
named <filename>genbki.pl</filename>.
Although it's specific to a particular <productname>PostgreSQL</productname>
release, <filename>postgres.bki</filename> is platform-independent and is
installed in the <filename>share</filename> subdirectory of the
installation tree.
</span>
カタログファイルを作り初期データをそこにロードするために、ブートストラップモードで実行中のバックエンドは、コマンドと初期データを含む<acronym class="acronym">BKI</acronym>(Backend Interface: バックエンドインタフェース)ファイルを読み込みます。
このモードで使用される<code class="filename">postgres.bki</code>は、<code class="filename">genbki.pl</code>というPerlスクリプトを使って、<span class="productname">PostgreSQL</span>ディストリビューションを構築する過程で前述のヘッダとデータファイルから作成されます。
<code class="filename">postgres.bki</code>は<span class="productname">PostgreSQL</span>の特定のリリースに固有のものですが、プラットフォームからは独立しており、インストレーションツリーの<code class="filename">share</code>サブディレクトリにインストールされます。
</p><p>
<span class="original">
<filename>genbki.pl</filename> also produces a derived header file for
each catalog, for example <filename>pg_class_d.h</filename> for
the <structname>pg_class</structname> catalog. This file contains
automatically-generated macro definitions, and may contain other macros,
enum declarations, and so on that can be useful for client C code that
reads a particular catalog.
</span>
<code class="filename">genbki.pl</code>は、他にも各々のカタログで使用する、たとえば<code class="structname">pg_class</code>のための<code class="filename">pg_class_d.h</code>のような派生ファイルを生成します。
このファイルには自動生成されたマクロ定義が含まれているほか、他のマクロとenum宣言も含まれており、特定のカタログを読み込むクライアントCコードに役立ちます。
</p><p>
<span class="original">
Most PostgreSQL developers don't need to be directly concerned with
the <acronym>BKI</acronym> file, but almost any nontrivial feature
addition in the backend will require modifying the catalog header files
and/or initial data files. The rest of this chapter gives some
information about that, and for completeness describes
the <acronym>BKI</acronym> file format.
</span>
ほとんどのPostgreSQL開発者は直接<acronym class="acronym">BKI</acronym>ファイルのことを気にかける必要はありませんが、バックエンドに些細ではない機能を追加する際にはカタログヘッダファイル、あるいはまた初期データファイルの変更が必要になるでしょう。
この章の残りの部分でそれについての情報をお届けします。
また網羅性のために、<acronym class="acronym">BKI</acronym>ファイルのフォーマットも説明します。
</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="two-phase.html" title="67.4. 2相トランザクション">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="internals.html" title="パート VII. 内部情報">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="system-catalog-declarations.html" title="68.1. システムカタログの宣言ルール">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">67.4. 2相トランザクション </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"> 68.1. システムカタログの宣言ルール</td></tr></table></div></body></html>