2 Chapter 39. The Rule System
7 39.2. Views and the Rule System
9 39.2.1. How SELECT Rules Work
10 39.2.2. View Rules in Non-SELECT Statements
11 39.2.3. The Power of Views in PostgreSQL
12 39.2.4. Updating a View
14 39.3. Materialized Views
15 39.4. Rules on INSERT, UPDATE, and DELETE
17 39.4.1. How Update Rules Work
18 39.4.2. Cooperation with Views
20 39.5. Rules and Privileges
21 39.6. Rules and Command Status
22 39.7. Rules Versus Triggers
24 This chapter discusses the rule system in PostgreSQL. Production rule
25 systems are conceptually simple, but there are many subtle points
26 involved in actually using them.
28 Some other database systems define active database rules, which are
29 usually stored procedures and triggers. In PostgreSQL, these can be
30 implemented using functions and triggers as well.
32 The rule system (more precisely speaking, the query rewrite rule
33 system) is totally different from stored procedures and triggers. It
34 modifies queries to take rules into consideration, and then passes the
35 modified query to the query planner for planning and execution. It is
36 very powerful, and can be used for many things such as query language
37 procedures, views, and versions. The theoretical foundations and the
38 power of this rule system are also discussed in [ston90b] and [ong90].