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 — The Rule System

November 19, 2026: PostgreSQL 19 Released!
Documentation → PostgreSQL 7.2
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.
PostgreSQL 7.2.8 Documentation
Prev Next

Chapter 16. The Rule System

Table of Contents
16.1. Introduction
16.2. What is a Query Tree?
16.3. Views and the Rule System
16.3.1. Implementation of Views in PostgreSQL
16.3.2. How SELECT Rules Work
16.3.3. View Rules in Non-SELECT Statements
16.3.4. The Power of Views in PostgreSQL
16.3.5. What about updating a view?
16.4. Rules on INSERT, UPDATE and DELETE
16.4.1. Differences from View Rules
16.4.2. How These Rules Work
16.4.3. Cooperation with Views
16.5. Rules and Permissions
16.6. Rules versus Triggers

Author: Written by Jan Wieck. Updates for 7.1 by Tom Lane.

16.1. Introduction

Production rule systems are conceptually simple, but there are many subtle points involved in actually using them. Some of these points and the theoretical foundations of the PostgreSQL rule system can be found in On Rules, Procedures, Caching and Views in Database Systems.

Some other database systems define active database rules. These are usually stored procedures and triggers and are implemented in PostgreSQL as functions and triggers.

The query rewrite rule system (the rule system from now on) 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 power of this rule system is discussed in A Unified Framework for Version Modeling Using Production Rules in a Database System as well as On Rules, Procedures, Caching and Views in Database Systems.


Prev Home Next
Extending SQL: Aggregates Up What is a 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.