Return-Path: owner-postman
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id RAA13599 for postgres-redist; Mon, 16 Jan 1995 17:02:56 -0800
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199501170102.RAA13599@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from homer16.u.washington.edu (homer16.u.washington.edu [140.142.70.17]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id RAA13589 for <postgres@nobozo.CS.Berkeley.EDU>; Mon, 16 Jan 1995 17:02:55 -0800
Received: by homer16.u.washington.edu
	(5.65+UW94.10/UW-NDC Revision: 2.32 ) id AA18240;
	Mon, 16 Jan 95 17:02:46 -0800
X-Sender: wei@homer16.u.washington.edu
Date: Mon, 16 Jan 1995 17:02:46 -0800 (PST)
From: Xinguo Wei <wei@u.washington.edu>
To: postgres <postgres@postgres.Berkeley.EDU>
Subject: a question on rules...
Message-Id: <Pine.A32.3.91c.950116162448.49307A-100000@homer16.u.washington.edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Mon, 16 Jan 95 17:02:56 -0800
Resent-XMts: smtp

Hi,

Say, I have two classes as defined below.

create emp (name = text, dept_name = text, age = int4) \g
create dept (name = text, members = setof emp) \g

I can append the dept class by the following postquel commands:

append dept (name = "toy", members = "retrieve (emp.all)
             where emp.dept_name = \\"toy\\"") \g
append dept (name = "shoe", members = "retrieve (emp.all)
             where emp.dept_name = \\"shoe\\"") \g
....

Noticing the same pattern on the declaration on members, I decided to 
create a rule on the append:

define function get_mem (language = "postquel", returntype = setof emp)
  arg is (text) as "retrieve (emp.all) where emp.dept_name = $1" \g
define rule get_mem_rule is on append to dept
  do replace new(members = get_mem(new.name)) \g

But, I got the following message from postgres when appending dept:

append dept(name = "toy")\g
Query sent to backend is "append dept(name = "toy")"
WARN:Jan 16 16:57:27:planAction has more than 1 items!

What is the problem here?



==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU".
   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/
