| From: | Tod McQuillin <devin(at)spamcop(dot)net> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Bug with rules in 7.0.3? |
| Date: | 2001-02-04 07:59:03 |
| Message-ID: | Pine.GSO.4.31.0102040144340.5691-100000@sysadmin |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On Sat, 3 Feb 2001, Tom Lane wrote:
> I get
>
> regression=# SELECT * FROM orders;
> order_id | menu_id | price
> ----------+---------+-------
> 1 | 2 | -1
> (1 row)
>
> which is the correct result given that rules are executed before the
> original query. (Which is why you need a trigger for this...)
OK.
I think that Bruce's book is inaccurate then. In section D.19 (p. 299),
also reproduced on the web at
http://www.postgresql.org/docs/aw_pgsql_book/node490.html, this example is
given:
All new employees must make 5,000 or less:
CREATE RULE example_5 AS
ON INSERT TO emp
WHERE new.salary > 5000 DO
UPDATE emp SET salary = 5000
WHERE emp.oid = new.oid;
--
Tod McQuillin
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joe Conway | 2001-02-04 08:04:00 | Fw: C function for use from PLpgSQL trigger |
| Previous Message | Tom Lane | 2001-02-03 22:15:51 | Re: PL/pgSQL: possible parsing or documentation bug? |