Return-Path: glass@postgres.Berkeley.EDU 
Delivery-Date: Wed, 31 Mar 93 14:46:48 -0800
Return-Path: glass@postgres.Berkeley.EDU
Received: from erewhon.CS.Berkeley.EDU by postgres.Berkeley.EDU (5.61/1.29)
	id AA12700; Wed, 31 Mar 93 14:46:28 -0800
Received: by erewhon.CS.Berkeley.EDU (5.57/Ultrix3.0-C) id AA28401; Wed, 31 Mar 93 14:46:35 -0800
Message-Id: <9303312246.AA28401@erewhon.CS.Berkeley.EDU>
To: aoki@postgres.berkeley.edu (Paul M. Aoki)
Subject: Re: [aoki@postgres.berkeley.edu: death] 
In-Reply-To: Your message of Wed, 31 Mar 93 14:41:33 PST.
             <9303312241.AA23753@faerie.CS.Berkeley.EDU> 
Date: Wed, 31 Mar 93 14:46:34 -0800
From: glass@postgres.Berkeley.EDU
X-Mts: smtp

> remove rewrite rule sharon_too_much
> destroy emp
> create emp (location=point,age=int4,name=char16,salary=int4,manager=char16,de
pt=char16)
> append emp(location="(11,10)"::point,age=20,name="bill",salary=1000,manager="
sharon",dept="toy")
> append emp(location="(11,10)"::point,age=31,name="carole",salary=6000,manager
="sharon",dept="toy")
> append emp(location="(15,12)"::point,age=25,name="sharon",salary=500,manager=
"sam",dept="shoe")
> append emp(location="(10,5)"::point,age=30,name="sam",salary=300,manager="bil
l",dept="candy")
> define rewrite rule sharon_too_much is on replace to emp.salary where current
.name="sharon" and new.salary > emp.salary and emp.name = current.manager do in
stead replace emp (salary=current.salary) where current.name="sharon"
> replace emp (salary=500) where emp.name="sharon"
> 

this rewrite rule should loop, but would get shut down due to the
number of loop invocations (i don't remember if i built in code to
give up on extreme numbers of rule invocations)

this rule declares on replace rule to 'emp.salary'. with an event
qualifier.

warning: my memory is very fuzzy on this:

event qualifiers don't work (except maybe for retrieves).  and it
explicitly says so somewhere.  or they don't work for retrieves or for
updates.  anyway this used to be stated somewhere.  

more importantly the action of this rule will trigger the rule again.
endlessly.

later,
Adam
