agora inbox for postgres@postgres.berkeley.edu
help / color / mirror / Atom feedFrom: Xinguo Wei <wei@u.washington.edu>
To: postgres <postgres@postgres.Berkeley.EDU>
Subject: a question on rules...
Date: Sun, 29 Jan 1995 22:53:50 -0800 (PST)
Message-ID: <Pine.A32.3.91c.950129224951.89183B-100000@homer19.u.washington.edu> (raw)
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/
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 using the --to and --cc options:
reply via email
To: postgres@postgres.berkeley.edu
Cc: wei@u.washington.edu
Subject: Re: a question on rules...
In-Reply-To: <Pine.A32.3.91c.950129224951.89183B-100000@homer19.u.washington.edu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox