Return-Path: postman
Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id VAA19128 for postgres-dist; Tue, 11 Jan 1994 21:36:11 -0800
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199401120536.VAA19128@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from zeta.saintjoe.edu (zeta.saintjoe.edu [131.93.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id VAA19119 for <postgres@postgres.berkeley.edu>; Tue, 11 Jan 1994 21:36:08 -0800
Received: from novo.saintjoe.EDU by zeta.saintjoe.edu (4.0/SMI-4.0)
	id AA28135; Tue, 11 Jan 94 23:32:07 CST
Received: by novo.saintjoe.EDU (4.1/SMI-4.1)
	id AA00437; Tue, 11 Jan 94 23:36:17 CST
Date: Tue, 11 Jan 94 23:36:17 CST
From: markd@novo.saintjoe.EDU (Mark Davisson)
Message-Id: <9401120536.AA00437@novo.saintjoe.EDU>
To: postgres@postgres.Berkeley.EDU
Subject: Extending the database with procedures
Resent-To: postgres-dist@postgres.Berkeley.EDU
Resent-Date: Tue, 11 Jan 94 21:36:10 -0800
Resent-XMts: smtp

I have been trying to define an attribute to contain a function but when
I use the procedure declaration (which is described in the documentation)
it says that procedure is an unknown type.  SO, I saw the regproc in the
built in types and used it to create a class as follows:
        create COMP (id=int4,
        code=char16,
        name=text,
        address=regproc,
        insurer=int4,
        contact=text,
        agent_id=int4,
        fax=int4,
        comments=text,
        descript=int4,
        date=tinterval,
        effect=int4)
then I created an address class so multiple objects can share the same class
without having to have the address imbedded in the object itself:
        reate ADDRESS (id=int4,
        id2=int4, 
        street=text, 
        street2=text, 
        city=text, 
        state=text, 
        zip=int4, 
        phone=int4)
Next, I appended some data into the COMP class, one of which is a function:
append COMP(id=1,
        name="HAP",
        address="retrieve (ADDRESS.all) where ADDRESS.id = 1)
Next, I threw some stuff in the ADDRESS class:
	append ADDRESS(id=1, street="123 COLDBROOK")
Now I should be able to do something like this to get the newly appended
address (let's assume I actually put useful data in the empty slots):
	retrieve (ADDRESS.all) where COMP.address.street = "123 COLDBROOK"
When I do this, however, it says that street is not a defined attribute.  Am
I missing some fundamental principle here (regproc is not the same idea as
the procedure declaration, etc.)  I have looked at Berkeley trying to find
some more documentation on the procedure declaration but the only thing I
found was Stonebrakers "Extending the database with procedures" that had
'procedure' as a type to use in the create statement.
Sorry so long but I wanted to give a concrete example.  Thanks for listening
and I look forward to hearing from someone.

Mark Davisson
markd@saintjoe.edu
