バージョンごとのドキュメント一覧

38.1. 拡張の作用法 #

<title>How Extensibility Works</title>

<productname>PostgreSQL</productname> is extensible because its operation is catalog-driven. If you are familiar with standard relational database systems, you know that they store information about databases, tables, columns, etc., in what are commonly known as system catalogs. (Some systems call this the data dictionary.) The catalogs appear to the user as tables like any other, but the <acronym>DBMS</acronym> stores its internal bookkeeping in them. One key difference between <productname>PostgreSQL</productname> and standard relational database systems is that <productname>PostgreSQL</productname> stores much more information in its catalogs: not only information about tables and columns, but also information about data types, functions, access methods, and so on. These tables can be modified by the user, and since <productname>PostgreSQL</productname> bases its operation on these tables, this means that <productname>PostgreSQL</productname> can be extended by users. By comparison, conventional database systems can only be extended by changing hardcoded procedures in the source code or by loading modules specially written by the <acronym>DBMS</acronym> vendor. PostgreSQLの動作は、カタログに定義された方法で駆動されているため拡張が可能です。 もし標準のリレーショナルデータベースシステムに慣れ親しんでいるのであれば、システムカタログとして一般に知られている中に、データベース、テーブル、列などの情報が格納されていることは知っていると思います。 (システムによってはデータディクショナリと呼ぶものもあります。) このカタログはユーザの目には他のテーブルと同じように見えますが、DBMSは内部情報をそこに格納しているのです。 PostgreSQLと標準的なリレーショナルデータベースシステムの重要な違いは、PostgreSQLはカタログにより多くの情報を格納するということです。 テーブルと列に関する情報だけではなく、データ型、関数、アクセスメソッドなどの情報も格納されています。 これらのテーブルはユーザが変更できます。そして、PostgreSQLは操作をこれらのテーブルに基づいて行うので、これはPostgreSQLがユーザによって拡張できることを意味します。 これに対して、一般のデータベースシステムでは、ソースコード内にハードコーディングされたプロシージャを変えるか、DBMSベンダによって特別に書かれたモジュールをロードしなければ拡張できません。

The <productname>PostgreSQL</productname> server can moreover incorporate user-written code into itself through dynamic loading. That is, the user can specify an object code file (e.g., a shared library) that implements a new type or function, and <productname>PostgreSQL</productname> will load it as required. Code written in <acronym>SQL</acronym> is even more trivial to add to the server. This ability to modify its operation <quote>on the fly</quote> makes <productname>PostgreSQL</productname> uniquely suited for rapid prototyping of new applications and storage structures. さらにPostgreSQLサーバは動的ローディングによってユーザの作成したコードを取り入れることができます。 つまり、ユーザが新しい型か関数を実装するオブジェクトコードファイル(例えば共有ライブラリ)を指定でき、PostgreSQLは要求された時にロードします。 SQLで作成されたコードをサーバに追加するのはさらに簡単です。 このように演算をその場で変えることができるため、PostgreSQLは新しいアプリケーションや格納構造をラピッドプロトタイプする場合に適しています。