agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
'retrieve into' in a rule?
2+ messages / 2 participants
[nested] [flat]

* 'retrieve into' in a rule?
@ 1994-05-09 14:59 keen@ms.uky.edu
  1994-05-09 23:01 ` Re: 'retrieve into' in a rule? Paul M. Aoki <aoki@postgres.Berkeley.EDU>
  0 siblings, 1 reply; 2+ messages in thread

From: keen@ms.uky.edu @ 1994-05-09 14:59 UTC (permalink / raw)
  To: legacy


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
keen@ms.uky.edu


===============================================================================
    To add/remove yourself 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.
===============================================================================




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: 'retrieve into' in a rule?
  1994-05-09 14:59 'retrieve into' in a rule? keen@ms.uky.edu
@ 1994-05-09 23:01 ` Paul M. Aoki <aoki@postgres.Berkeley.EDU>
  0 siblings, 0 replies; 2+ messages in thread

From: Paul M. Aoki @ 1994-05-09 23:01 UTC (permalink / raw)
  To: keen@ms.uky.edu; +Cc: legacy

keen@ms.uky.edu writes:
> "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"
> 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.

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  |  aoki@postgres.Berkeley.EDU
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki

===============================================================================
    To add/remove yourself 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.
===============================================================================




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1994-05-09 23:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1994-05-09 14:59 'retrieve into' in a rule? keen@ms.uky.edu
1994-05-09 23:01 ` Paul M. Aoki <aoki@postgres.Berkeley.EDU>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox