Subject: 'retrieve into' in a rule?

From: [email-masked]
Date: Mon, 9 May 1994 10:59:52 -0400 (EDT)

I am running with Postgres 4.2.

When I give a command to the monitor like
"retrieve into temp (emp.name) where emp.age = 40\g"

it works fine and creates the class temp with the info,
BUT if I put the same kind of command into a _rule_,

"define rule r5 is on 
retrieve to emp.age where current.age ISNULL
 do [retrieve into x (emp.all) where emp.dept= current.dept ] \g"

the rule is defined alright, 
but when I actually try to retrieve from emp, 
"retrieve (emp.all) \g"
I get a message that "type x already defined" 
and no tuples are retrieved.

Suggestions?

Debby Keen
[email-masked]

===============================================================================
    To add/remove yourself from the POSTGRES mailing list: send mail with 
    the subject line ADD or DEL to "[email-masked]"

    If this fails, send mail to "[email-masked]" and
    a human will deal with it.  DO NOT post to the "postgres" mailing list.
===============================================================================

---

From: [email-masked] (Paul M. Aoki)
Date: Mon, 09 May 94 16:01:46 -0700

> and no tuples are retrieved.

so is this rule run more than once?

you're using the tuple-level rule system, so if there is more
than one emp with null age, the rule will be fired more than
once.  of course, once the rule is fired, there's now an "x"
table and any following firings of the rule will blow out the 
whole query (because "x" already exists).

seems like you should probably append to x (if you can do so).
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  [email-masked]
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki