Subject: Help with a function

From: [email-masked]
Date: Tue, 21 Sep 1993 09:47 +1300

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
[email-masked]
Information Science Dept.
University Of Otago
New Zealand