agora inbox for postgres@postgres.berkeley.edu
help / color / mirror / Atom feedFrom: Mark Davisson <markd@novo.saintjoe.EDU>
To: postgres@postgres.Berkeley.EDU
Subject: Extending the database with procedures
Date: Tue, 11 Jan 94 23:36:17 CST
Message-ID: <9401120536.AA00437@novo.saintjoe.EDU> (raw)
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
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: markd@novo.saintjoe.EDU
Subject: Re: Extending the database with procedures
In-Reply-To: <9401120536.AA00437@novo.saintjoe.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