agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Paul M. Aoki <aoki@cs.berkeley.edu>
To: WEIX%PTHWRK.allin1@puget.com
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: Questions on Virtual Attributes
Date: Sun, 02 Oct 94 12:34:45 -0700
Message-ID: <199410021934.MAA13941@nobozo.CS.Berkeley.EDU> (raw)
In-Reply-To: <9410020639.AA23035@mdd.comm.mot.com>

"WEIX%PTHWRK.allin1"@puget.com writes:
> create EMP (name = text, dept = text)\g
> create DEPT (name = text, emp_no = setof int4) \g

create FOO (a = int4) \g
create DEPT (name = text, emp_no = setof FOO) \g

> append EMP (name = "a", dept = "candy")\g
> append EMP (name = "b", dept = "candy")\g
> append DEPT (name = "candy",
>   emp_no = "retrieve (a = count{EMP.name where EMP.dept = \\"candy\\"})") \g
> retrieve (DEPT.name, DEPT.emp_no) \g
> Query sent to backend is "retrieve (dept.name, dept.emp_no) "
> -----------------------------
> | name        | emp_no      |
> -----------------------------
> | candy       | 25252       |
> -----------------------------
>  The value of emp_no here looks like an OID. What kind of object is that? How
>  can i get the correct value of 2 ?

by dereferencing it.  the only thing you can do with a set is project
an attribute from it.

* retrieve (DEPT.name, DEPT.emp_no.a)\g

Query sent to backend is "retrieve (DEPT.name, DEPT.emp_no.a)"
-----------------------------
| name        | a           |
-----------------------------
| candy       | 2           |
-----------------------------

Go 
*
--
  Paul M. Aoki          |  University of California at Berkeley
  aoki@CS.Berkeley.EDU  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776

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



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: aoki@cs.berkeley.edu, WEIX%PTHWRK.allin1@puget.com
  Subject: Re: Questions on Virtual Attributes
  In-Reply-To: <199410021934.MAA13941@nobozo.CS.Berkeley.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