GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Home
  • About
  • Download
  • Documentation
  • Community
  • Developers
  • Support
  • Donate
  • Your account

This view

  • Original page
  • New address

GeezerVison is showing www.postgresql.org — Chapter 40. The Rule System

November 19, 2026: PostgreSQL 19 Released!
Documentation → PostgreSQL 13
Supported Versions: Current (19) / 18 / 17 / 16 / 15
Development Versions: devel
Unsupported versions: 14 / 13 / 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3 / 7.2 / 7.1
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.
Chapter 40. The Rule System
Prev  Up Part V. Server Programming Home  Next

Chapter 40. The Rule System

Table of Contents

40.1. The Query Tree
40.2. Views and the Rule System
40.2.1. How SELECT Rules Work
40.2.2. View Rules in Non-SELECT Statements
40.2.3. The Power of Views in PostgreSQL
40.2.4. Updating a View
40.3. Materialized Views
40.4. Rules on INSERT, UPDATE, and DELETE
40.4.1. How Update Rules Work
40.4.2. Cooperation with Views
40.5. Rules and Privileges
40.6. Rules and Command Status
40.7. Rules Versus Triggers

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.

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.

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 [ston90b] and [ong90].


Prev  Up  Next
39.5. A Table Rewrite Event Trigger Example  Home  40.1. The Query Tree
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.