pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tod McQuillin <devin@spamcop.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Bug with rules in 7.0.3?
Date: Sun, 4 Feb 2001 22:37:45 -0500 (EST)
Message-ID: <200102050337.WAA26367@candle.pha.pa.us> (raw)
In-Reply-To: <Pine.GSO.4.31.0102040144340.5691-100000@sysadmin>

> 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;

I checked the current create_rule.sgml file, and this example query is
no longer in the file.  Not sure why it was removed, but it will not
appear in 7.1.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (4+ messages)

Message-ID: <200102050337.WAA26367@candle.pha.pa.us>
Permalink:  ../200102050337.WAA26367@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200102050337.WAA26367@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: pgman@candle.pha.pa.us, devin@spamcop.net, tgl@sss.pgh.pa.us
  Subject: Re: Bug with rules in 7.0.3?
  In-Reply-To: <200102050337.WAA26367@candle.pha.pa.us>
  References: <Pine.GSO.4.31.0102040144340.5691-100000@sysadmin> <200102050337.WAA26367@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox