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

第41章 ルールシステム

目次

41.1. 問い合わせツリーとは
41.2. ビューとルールシステム
41.2.1. SELECTルールの動き
41.2.2. 非SELECT文のビュールール
41.2.3. PostgreSQLにおけるビューの能力
41.2.4. ビューの更新について
41.3. マテリアライズドビュー
41.4. INSERTUPDATEDELETEについてのルール
41.4.1. 更新ルールの動作
41.4.2. ビューとの協調
41.5. ルールと権限
41.6. ルールおよびコマンドの状態
41.7. ルール対トリガ
<title>The Rule System</title>

This chapter discusses the rule system in <productname>PostgreSQL</productname>. Production rule systems are conceptually simple, but there are many subtle points involved in actually using them. 本章ではPostgreSQLのルールシステムについて説明します。 本番で稼働するルールシステムは概念としては単純ですが、実際に使ってみると、わかりにくいところが少なからずあります。

Some other database systems define active database rules, which are usually stored procedures and triggers. In <productname>PostgreSQL</productname>, these can be implemented using functions and triggers as well. 通常それらはストアドプロシージャとトリガですが、他のいくつかのデータベースシステムは能動的データベースルールを定義しています。 PostgreSQLでは関数とトリガとして実装されています。

The rule system (more precisely speaking, the query rewrite rule system) is totally different from stored procedures and triggers. It modifies queries to take rules into consideration, and then passes the modified query to the query planner for planning and execution. It is very powerful, and can be used for many things such as query language procedures, views, and versions. The theoretical foundations and the power of this rule system are also discussed in <xref linkend="ston90b"/> and <xref linkend="ong90"/>. ルールシステム(より正確に言うと問い合わせ書き換えルールシステム)はストアドプロシージャとトリガとはまったく異なります。 ルールシステムはルールを参照して問い合わせを修正し、修正した問い合わせを、計画作成と実行のために問い合わせプランナに渡します。 これは非常に強力なため、問い合わせ言語プロシージャ、ビューあるいはバージョンなど多くのパターンで使用することができます。 このルールシステムの基礎理論と能力は[ston90b]および[ong90]で解説されています。