|
1 | 1 | <!-- |
2 | | -$PostgreSQL: pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.42 2003/11/29 19:51:38 pgsql Exp $ |
| 2 | +$PostgreSQL: pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.43 2004/03/04 14:32:12 momjian Exp $ |
3 | 3 | PostgreSQL documentation |
4 | 4 | --> |
5 | 5 |
|
@@ -42,15 +42,15 @@ CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS |
42 | 42 | define an alternate action to be performed on insertions, updates, |
43 | 43 | or deletions in database tables. Roughly speaking, a rule causes |
44 | 44 | additional commands to be executed when a given command on a given |
45 | | - table is executed. Alternatively,a rule can replace a given |
46 | | - command by another, or cause a commandnot to be executed at all. |
47 | | -Rules are used to implement table views as well. It is important |
48 | | - to realize that a rule is reallya command transformation |
49 | | - mechanism, or command macro. Thetransformation happens before the |
50 | | - execution of the commands starts.If you actually want an |
51 | | - operation that fires independently for eachphysical row, you |
52 | | - probably want to use a trigger, not a rule.More information about |
53 | | - the rules system is in <xref linkend="rules">. |
| 45 | + table is executed. Alternatively,an <literal>INSTEAD</literal> |
| 46 | +rule can replace a givencommand by another, or cause a command |
| 47 | +not to be executed at all. Rules are used to implement table |
| 48 | +views as well. It is importantto realize that a rule is really |
| 49 | +a command transformationmechanism, or command macro. The |
| 50 | +transformation happens before theexecution of the commands starts. |
| 51 | +If you actually want anoperation that fires independently for each |
| 52 | +physical row, youprobably want to use a trigger, not a rule. |
| 53 | +More information aboutthe rules system is in <xref linkend="rules">. |
54 | 54 | </para> |
55 | 55 |
|
56 | 56 | <para> |
@@ -140,6 +140,17 @@ CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS |
140 | 140 | </listitem> |
141 | 141 | </varlistentry> |
142 | 142 |
|
| 143 | + <varlistentry> |
| 144 | + <term><option>INSTEAD</option></term> |
| 145 | + <listitem> |
| 146 | + <para> |
| 147 | + <literal>INSTEAD</literal> indicates that the commands should be |
| 148 | + executed <emphasis>instead</> of the original command, not in |
| 149 | + addition to the original command. |
| 150 | + </para> |
| 151 | + </listitem> |
| 152 | + </varlistentry> |
| 153 | + |
143 | 154 | <varlistentry> |
144 | 155 | <term><replaceable class="parameter">command</replaceable></term> |
145 | 156 | <listitem> |
|