]> begriffs open source - ai-pg/blob - full-docs/txt/rule-system.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / rule-system.txt
1
2 51.4. The PostgreSQL Rule System #
3
4    PostgreSQL supports a powerful rule system for the specification of
5    views and ambiguous view updates. Originally the PostgreSQL rule system
6    consisted of two implementations:
7      * The first one worked using row level processing and was implemented
8        deep in the executor. The rule system was called whenever an
9        individual row had been accessed. This implementation was removed
10        in 1995 when the last official release of the Berkeley Postgres
11        project was transformed into Postgres95.
12      * The second implementation of the rule system is a technique called
13        query rewriting. The rewrite system is a module that exists between
14        the parser stage and the planner/optimizer. This technique is still
15        implemented.
16
17    The query rewriter is discussed in some detail in Chapter 39, so there
18    is no need to cover it here. We will only point out that both the input
19    and the output of the rewriter are query trees, that is, there is no
20    change in the representation or level of semantic detail in the trees.
21    Rewriting can be thought of as a form of macro expansion.