Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA29606; Wed, 28 Apr 93 23:47:47 -0700
Date: Wed, 28 Apr 93 23:47:47 -0700
Message-Id: <9304290647.AA29606@postgres.Berkeley.EDU>
From: witr@rwwa.COM
Subject: Functions in querys
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
Content-Type: text
Content-Length: 1096

Suppose you wish to compute some function of an attribute which
requires as input the results of some other computation on an
attribute.  For example, suppose you have a function

    define function atype_foo
      (language = c, returntype = aType)
      arg is (aAtrType)
      as "atype.so"

which returns the ``fooishness'' of an attribute of type aAtrType.
Suppose you have another function:

    define function atype_fee
      (language = c, returntype = anotherType)
      arg is (aAtrType,aType)
      as "atype.so"

which returns the ``feeishness'' of an attribut of type aAtrType,
given the ``fooishness''.  Assume both functions take lots of time to
compute. 

How do you query to get both of these values in one pass?

What I want to do is something like

  retrieve (foo=atype_foo(i.attr),fee=atype_fee(i.attr,foo)) from i in
   CLASS;

But that doesn't work (in 4.0.1).  Is there a general solution for
this type of thing?

---
 Robert Withrow, Tel: +1 617 598 4480, Fax: +1 617 598 4430, Net: witr@rwwa.COM
 R.W. Withrow Associates, 21 Railroad Ave, Swampscott MA 01907-1821 USA
