Return-Path: postman 
Delivery-Date: Fri, 17 Sep 93 11:42:58 PDT
Return-Path: postman
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA04549; Fri, 17 Sep 93 11:39:04 -0700
Resent-From: postman (POSTGRES mailing list)
Resent-Message-Id: <9309171839.AA04549@postgres.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: aoki@postgres.Berkeley.EDU
Received: from faerie.CS.Berkeley.EDU by postgres.Berkeley.EDU (5.61/1.29)
	id AA04541; Fri, 17 Sep 93 11:38:57 -0700
Received: from localhost (localhost [127.0.0.1]) by faerie.CS.Berkeley.EDU (8.1C/8.1B) with SMTP id LAA10139; Fri, 17 Sep 1993 11:39:31 -0700
Message-Id: <199309171839.LAA10139@faerie.CS.Berkeley.EDU>
From: aoki@postgres.Berkeley.EDU (Paul M. Aoki)
To: fernando@afrodita.etsimo.uniovi.es (Fernando Ariznavarreta)
Cc: postgres@postgres.Berkeley.EDU (Postgres Lista de correo.)
Subject: Re: What's wrong with rules? 
In-Reply-To: Your message of Sat, 17 Jul 1993 10:46:44 +0100 (MDT) 
	     <9307170846.AA03360@afrodita.etsimo.uniovi.es> 
Date: Fri, 17 Sep 93 11:39:31 -0700
X-Sender: aoki@postgres.Berkeley.EDU
X-Mts: smtp
Resent-To: postgres-dist
Resent-Date: Fri, 17 Sep 93 11:39:02 PDT

fernando@afrodita.etsimo.uniovi.es (Fernando Ariznavarreta) writes:
> define rewrite rule AB_a
> is on append to AB 
> do instead append B(b= current.b,aoid= A.oid) where A.a= current.a \g

i think you're getting hung up in the funky semantics of rewrite rules.
i don't understand them myself so i can't help you.
(could just be a bug.  i stared at the query plan that the rewrite
system produced for a couple of minutes and couldn't figure out why 
the heck it would want to produce two range variables with the same 
name and class oid in the same plan..)

but unless i misunderstand your example, i think
	define rule AB_a
	is on append to AB
	do instead append B(b= new.b, aoid=A.oid) where A.a = new.a
does what you want..
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  aoki@postgres.Berkeley.EDU
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki
