Having introduced the basic extensibility concepts, we can now take a look at how the catalogs are actually laid out. You can skip this section for now, but some later sections will be incomprehensible without the information given here, so mark this page for later reference. All system catalogs have names that begin with pg_. The following classes contain information that may be useful to the end user. (There are many other system catalogs, but there should rarely be a reason to query them directly.)
ここまでで拡張性の基礎的な概念についての紹介が終りましたので、 ここからはカタログが実際にどう設置されているかを示すことにしま す。今のところこの節を飛ばしても構いませんが、この節の情報無し では少し後の節を理解することはできないと思います。後で参照でき るように印をつけておいて下さい。全システムカタログの名前は pg_から始まります。後述のクラスは、エン ドユーザにとって有益になるような情報を持っています。(他にも多 くのシステムカタログがありますが、直接それらを問い合わせなけれ ばならないような理由はほとんどないはずです。)
Table 3-1. Postgres システムカタログ
カタログ名 | 説明 |
---|---|
pg_database | データベース |
pg_class | クラス |
pg_attribute | クラス属性 |
pg_index | 二次インデックス |
pg_proc | プロシージャ( C 及び SQL ) |
pg_type | 型(基本型及び複合型) |
pg_operator | 演算子 |
pg_aggregate | 集約及び集約関数 |
pg_am | アクセスメソッド |
pg_amop | アクセスメソッド演算子 |
pg_amproc | アクセスメソッド・サポート関数 |
pg_opclass | アクセスメソッド演算子クラス |
In several of the sections that follow, we will present various join queries on the system catalogs that display information we need to extend the system. Looking at this diagram should make some of these join queries (which are often three- or four-way joins) more understandable, because you will be able to see that the attributes used in the queries form foreign keys in other classes.
後述のいくつかの節では、システムの拡張に必要となる情報を表示す る多種のシステムカタログの結合問い合わせを提示します。これらの( 大抵 3 から 4 個の結合となる)結合問い合わせ中で使われている属 性が他のクラスの外部キーとなっていることが判りますので、この図 を見ることでいくつかの問い合わせはより判り易くなるでしょう。
多種の(クラス、属性、関数、型、アクセスメソッドといった) 主要項目がこのスキーマ内でしっかりと統合されています。単純 な CREATE コマンドで、このカタログの多くの部分を変更するこ とができます。
型とプロシージャがこのスキーマの中核となります。
Note: We use the words procedure and function more or less interchangably.
プロシージャ という単語と 関数という単語はどちらを使っても良いというような意味合で使っています。
解りきった意味を持っている属性や関連性は数多くあります。 しかし、(特にアクセスメソッドに関するものの場合)そうで ないものも多くあります。特に pg_am、pg_amop、pg_amproc、 pg_operator、pg_opclass 間の関連性は理解し難いもので、拡 張の基礎部分を説明した後(インデックスに対する型と演算子のイ ンタフェースの節で)に詳しく説明する予定です。