Return-Path: postman 
Delivery-Date: Mon, 20 Sep 93 14:58:16 PDT
Return-Path: postman
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA23086; Mon, 20 Sep 93 14:50:45 -0700
Resent-From: postman (POSTGRES mailing list)
Resent-Message-Id: <9309202150.AA23086@postgres.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: INFOAL@rivendell.otago.ac.nz
Received: from thorin.otago.ac.nz by postgres.Berkeley.EDU (5.61/1.29)
	id AA23078; Mon, 20 Sep 93 14:50:36 -0700
Received: from rivendell.otago.ac.nz by rivendell.otago.ac.nz (PMDF #12052) id
 <01H37F6C6I8WB3KJWD@rivendell.otago.ac.nz>; Tue, 21 Sep 1993 09:47 +1300
Date: Tue, 21 Sep 1993 09:47 +1300
From: INFOAL@rivendell.otago.ac.nz
Subject: Help with a function
To: postgres@postgres.berkeley.EDU
Message-Id: <01H37F6C6I8WB3KJWD@rivendell.otago.ac.nz>
X-Envelope-To: postgres@postgres.berkeley.EDU
X-Vms-To: IN%"postgres@postgres.berkeley.EDU"
Resent-To: postgres-dist
Resent-Date: Mon, 20 Sep 93 14:50:43 PDT

Hi, 


Is there any way to define a function forward (as with pascal) in postgres.

If I have 

  create lines 
   (inv_no = char16,
    prod_no = char16,
    quantity = int4
   )

and 

  define function set_of_lines 
    (language = "postquel", returntype = setof lines)
    as "retrieve (lines.all)
        where lines.inv_no = $.inv_no"


and

  create invoice
    (inv_no = char16,
     cust_no = char16,
     line = set_of_lines,
     .....
    )

I am trying to get the function set_of_lines to return all of the lines of a
particular invoice.  If I dont specify $1.inv_no it gives me an error.  If on
the other hand I specify an     arg is (invoice)      clause, it gives an error
as the class invoice has not yet been created.

If I put the function after the create class statement it tells me that the
function set_of_lines does not exist.

If there is someway of letting it know that I am declaring the function, and
then defining the function further down, it should solve all my problems
(hopefully!).

I am running Version 4.1 on Ultrix. 


Thanks for your help,


Alistair Ashcroft
InfoAl@Otago.Ac.NZ
Information Science Dept.
University Of Otago
New Zealand


