agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
Questions on Virtual Attributes
3+ messages / 2 participants
[nested] [flat]

* Questions on Virtual Attributes
@ 1994-10-01 23:38 WEIX%PTHWRK.allin1@puget.com
  1994-10-02 19:34 ` Re: Questions on Virtual Attributes Paul M. Aoki <aoki@cs.berkeley.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: WEIX%PTHWRK.allin1@puget.com @ 1994-10-01 23:38 UTC (permalink / raw)
  To: legacy

From:	NAME: Xinguo Wei                    
	FUNC:                                 
	TEL:                                  <WEIX AT A1 AT PTHWRK>
To:	smtp%"postgres@postgres.berkeley.edu"@mrgate


Hi,

I am testing the virtual attribute function using the SET expression and I have
two questions here.
1. When define the attribute using X = setof Y, the keyword "setof" seems not
necessary if Y is a class name, i.e., "members = EMP" is the same as "members =
setof EMP".  If Y is not a class name, then "setof" is needed.  Am I right?

2. In the following test case, I defined a set attribute for DEPT. But I
couldn't find the way to retrive its value!!  Please help me.

create EMP (name = text, dept = text)\g
create DEPT (name = text, emp_no = setof int4) \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 ?

 Thanks!!

 Xinguo Wei

 weix@puget.com


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



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

* Re: Questions on Virtual Attributes
  1994-10-01 23:38 Questions on Virtual Attributes WEIX%PTHWRK.allin1@puget.com
@ 1994-10-02 19:34 ` Paul M. Aoki <aoki@cs.berkeley.edu>
  0 siblings, 0 replies; 3+ messages in thread

From: Paul M. Aoki @ 1994-10-02 19:34 UTC (permalink / raw)
  To: WEIX%PTHWRK.allin1@puget.com; +Cc: legacy

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



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

* Questions on Virtual Attributes....
@ 1994-10-03 15:36 WEIX%PTHWRK.allin1@puget.com
  0 siblings, 0 replies; 3+ messages in thread

From: WEIX%PTHWRK.allin1@puget.com @ 1994-10-03 15:36 UTC (permalink / raw)
  To: legacy

From:	NAME: Xinguo Wei                    
	FUNC:                                 
	TEL:                                  <WEIX AT A1 AT PTHWRK>
To:	smtp%"postgres@nobozo.CS.Berkeley.EDU"@mrgate


Hi,

I am testing the virtual attribute function using the SET expression and I have
two questions here.
1. When define the attribute using X = setof Y, the keyword "setof" seems not
necessary if Y is a class name, i.e., "members = EMP" is the same as "members =
setof EMP".  If Y is not a class name, then "setof" is needed.  Am I right?

2. In the following test case, I defined a set attribute for DEPT. But I
couldn't find the way to retrive its value!!  Please help me.

create EMP (name = text, dept = text)\g
create DEPT (name = text, emp_no = setof int4) \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 ?

 Thanks!!

 Xinguo Wei

 weix@puget.com


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



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


end of thread, other threads:[~1994-10-03 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1994-10-01 23:38 Questions on Virtual Attributes WEIX%PTHWRK.allin1@puget.com
1994-10-02 19:34 ` Paul M. Aoki <aoki@cs.berkeley.edu>
1994-10-03 15:36 Questions on Virtual Attributes.... WEIX%PTHWRK.allin1@puget.com

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