Postgresql 中文操作指南
Chapter 41. The Rule System
Table of Contents
本章讨论了 PostgreSQL 中的规则系统。生成规则系统概念简单,但是实际使用它们涉及许多微妙的点。
This chapter discusses the rule system in PostgreSQL. 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 PostgreSQL, these can be implemented using functions and triggers as well.
规则系统(更准确地说,查询重写规则系统)与存储过程和触发器完全不同。它修改查询以考虑规则,然后将修改后的查询传递给查询计划程序进行计划和执行。它非常强大,可用于许多事情,例如查询语言过程、视图和版本。该规则系统的理论基础及其功能也在 [id="ston90b",role="bare"]biblio.html#STON90B [id="ston90b"] 和 [id="ong90",role="bare"]biblio.html#ONG90 [id="ong90"] 中进行了讨论。
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 biblio.html#STON90B and biblio.html#ONG90.