1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.14 2000/04/07 19:17:30 momjian Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.15 2000/04/12 20:07:13 momjian Exp $
3
3
Postgres documentation
4
4
-->
5
5
@@ -71,7 +71,7 @@ CREATE RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable
71
71
<listitem>
72
72
<para>
73
73
Any SQL WHERE clause, <literal>new</literal> or
74
- <literal>current </literal> can appear instead of an instance
74
+ <literal>old </literal> can appear instead of an instance
75
75
variable whenever an instance variable is permissible in SQL.
76
76
</para>
77
77
</listitem>
@@ -81,7 +81,7 @@ CREATE RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable
81
81
<listitem>
82
82
<para>
83
83
Any SQL statement, <literal>new</literal> or
84
- <literal>current </literal> can appear instead of an instance
84
+ <literal>old </literal> can appear instead of an instance
85
85
variable whenever an instance variable is permissible in SQL.
86
86
</para>
87
87
</listitem>
@@ -133,17 +133,17 @@ CREATE
133
133
134
134
<para>
135
135
The semantics of a rule is that at the time an individual instance is
136
- accessed, inserted, updated, or deleted, there is a current instance (for
136
+ accessed, inserted, updated, or deleted, there is a old instance (for
137
137
selects, updates and deletes) and a new instance (for inserts and
138
138
updates).
139
139
If the <replaceable class="parameter">event</replaceable>
140
140
specified in the ON clause and the
141
141
<replaceable class="parameter">condition</replaceable> specified in the
142
- WHERE clause are true for the current instance, the
142
+ WHERE clause are true for the old instance, the
143
143
<replaceable class="parameter">action</replaceable> part of the rule is
144
- executed. First, however, values from fields in the current instance
144
+ executed. First, however, values from fields in the old instance
145
145
and/or the new instance are substituted for
146
- <literal>current .</literal><replaceable class="parameter">attribute-name</replaceable>
146
+ <literal>old .</literal><replaceable class="parameter">attribute-name</replaceable>
147
147
and <literal>new.</literal><replaceable class="parameter">attribute-name</replaceable>.
148
148
</para>
149
149
@@ -167,7 +167,7 @@ CREATE
167
167
<replaceable class="parameter">condition</replaceable> and
168
168
<replaceable class="parameter">action</replaceable> parts of a rule,
169
169
they are all considered different tuple variables. More accurately,
170
- <literal>new</literal> and <literal>current </literal> are the only tuple
170
+ <literal>new</literal> and <literal>old </literal> are the only tuple
171
171
variables that are shared between these clauses. For example, the following
172
172
two rules have the same semantics:
173
173
<programlisting>
@@ -263,15 +263,15 @@ SELECT * FROM emp;
263
263
264
264
<programlisting>
265
265
CREATE RULE example_1 AS
266
- ON UPDATE emp.salary WHERE current .name = "Joe"
266
+ ON UPDATE emp.salary WHERE old .name = "Joe"
267
267
DO
268
268
UPDATE emp
269
269
SET salary = new.salary
270
270
WHERE emp.name = "Sam";
271
271
</programlisting>
272
272
273
273
At the time Joe receives a salary adjustment, the event
274
- will become true and Joe's current instance and proposed
274
+ will become true and Joe's old instance and proposed
275
275
new instance are available to the execution routines.
276
276
Hence, his new salary is substituted into the action part
277
277
of the rule which is subsequently executed. This propagates
@@ -282,7 +282,7 @@ CREATE RULE example_1 AS
282
282
<programlisting>
283
283
CREATE RULE example_2 AS
284
284
ON SELECT TO EMP.salary
285
- WHERE current .name = "Bill"
285
+ WHERE old .name = "Bill"
286
286
DO INSTEAD
287
287
SELECT emp.salary
288
288
FROM emp
@@ -297,7 +297,7 @@ CREATE RULE example_2 AS
297
297
CREATE RULE example_3 AS
298
298
ON
299
299
SELECT TO emp.salary
300
- WHERE current .dept = "shoe" AND current_user = "Joe"
300
+ WHERE old .dept = "shoe" AND current_user = "Joe"
301
301
DO INSTEAD NOTHING;
302
302
</programlisting>
303
303
</para>
0 commit comments