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 WAA01687 for postgres-redist; Sun, 29 Jan 1995 22:54:01 -0800
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199501300654.WAA01687@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 homer19.u.washington.edu (homer19.u.washington.edu [140.142.76.3]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id WAA01677 for <postgres@nobozo.CS.Berkeley.EDU>; Sun, 29 Jan 1995 22:54:00 -0800
Received: by homer19.u.washington.edu
	(5.65+UW94.10/UW-NDC Revision: 2.32 ) id AA91847;
	Sun, 29 Jan 95 22:53:51 -0800
X-Sender: wei@homer19.u.washington.edu
Date: Sun, 29 Jan 1995 22:53:50 -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.950129224951.89183B-100000@homer19.u.washington.edu>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Sun, 29 Jan 95 22:54:01 -0800
Resent-XMts: smtp



Hi,

I posted this question before but didn't get any response. So I asked it 
here again.

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?

Xinguo Wei




==============================================================================
   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/
