Subject: 3 Quests

From: Wolf Guddat <[email-masked]>
Date: Tue, 17 Aug 93 15:03:29 MESZ

Hi Everybody,

I've got some questions concering some statements in the 
manual which i think do not work as they sould.

Q1: "Each new class name is automatically created as a type"

     I'm not able to create a class which has an attribute of such
     a complex type. (e.g MYCLASS (att1=ANOTHERCLASS) )
     Does this mean this feature is not available. If so why isn't it
     mentioned somewhere?

Q2: Using attributes of type "postquel"

    I know that this isn't running now. I read some short message about
    regproc. What's in detail is it? If i define a postquel-function
    MYFUNCTION and after that create a class 
      MYCLASS (fct=regproc)
    i can do appends like this:
      append MYCLASS (fct = "MYFUNCTION")
    But how can i invoke the execution of the postquel-function when retrieving
    the attribute MYCLASS.fct
      retrieve (MYCLASS.fct) 
    only returns "MYFUNCTION" and doesn't execute it. 
    I was not able to find some detailed information about regproc.

Q3: If i do an append to a class and i do not specify all attributes then 
    these attributes do not have a value (the monitor tells me "(null)").
    Is it possible to return this special "null-value" from 
    a user defined function and how is it implemented? I will need this
    feature for implementing OPTIONAL data-types.

I would be glad to hear from everyone who has a little experiences with one
of this questions.  

Thanks Wolf

*****************************************************
**                                                 **
**                  Wolf Guddat                    **
**                                                 **
**       [email-masked]         **
**   [email-masked]    **
**                                                 **
**       University of Erlangen/Nuernberg          **
**                     Germany                     **
**                                                 **
**     Postgres 4.1, DECstation, ULTRIX 4.3        **
**                                                 **
*****************************************************

---

From: [email-masked] (Paul M. Aoki)
Date: Sun, 22 Aug 93 17:42:45 -0700

>      a complex type. (e.g MYCLASS (att1=ANOTHERCLASS) )

this kind of complex types were implemented as demoware in 3.1 that
broke in 4.0.  you can still do complex types in 4.0.1 and 4.1 using 
postquel functions.  carol paxson has just finished a better 
implementation for 4.2/5.0/whatever-marc-decides-to-call-it..

>     regproc.

carol implemented procedural set support, which means working complex 
types plus procedural definition of sets.  i think this is basically what 
you're asking about.

>     a user defined function and how is it implemented?

actually, the "(null)" from monitor comes from printf trying to 
dereference a null char * :-P  but that's a side issue.

you can determine whether an attribute in a tuple is null using the 
ISNULL/NOTNULL keywords.  this is the only use of null that you should
expect to work consistently.

how a null value is returned from a user-defined function is a different
bag of worms.  for example.  several types that are passed by reference
indicate null using NULL pointers.  fine.  but on many machines there 
are no bit patterns that are invalid integers, so how do you represent
null integers?  it depends on your user-defined type.

so the short answer is, with the exception of null attributes, it depends 
on how you defined your data type.
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  [email-masked]
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki