Return-Path: INFOAL@rivendell.otago.ac.nz 
Delivery-Date: Fri, 17 Sep 93 19:26:31 PDT
Return-Path: INFOAL@rivendell.otago.ac.nz
Received: from thorin.otago.ac.nz by postgres.Berkeley.EDU (5.61/1.29)
	id AA09882; Fri, 17 Sep 93 19:22:52 -0700
Received: from rivendell.otago.ac.nz by rivendell.otago.ac.nz (PMDF #12052) id
 <01H33GSFGHJ4B3KIBN@rivendell.otago.ac.nz>; Sat, 18 Sep 1993 13:50 +1300
Date: Sat, 18 Sep 1993 13:50 +1300
From: INFOAL@rivendell.otago.ac.nz
Subject: Simple Query
To: postgres-dist@postgres.berkeley.EDU
Message-Id: <01H33GSFGHJ4B3KIBN@rivendell.otago.ac.nz>
X-Envelope-To: postgres-dist@postgres.berkeley.EDU
X-Vms-To: IN%"postgres-dist@postgres.berkeley.EDU"

Hi,

I am trying to write a postquel function that returns all of an invoices 
header and the corresponding lines.

I have written a postquel function such that

  define function get_invoice
    (langauge = "postquel", returntype = setof inv_details)
     arg is (invoice)
     as "retrieve (inv_detail.all)
     where $1.inv_no = inv_details.inv_no"
  \g

I then do a query

  * retrieve (invoice.inv_no, invoice.cust_no
              details = invoice.get_details.inv_no)
              where invoice.inv_no = "XXXXX" \g

The only problem with this is that it only returns the invoice number from
the inv_details file.  It does not also all me to get
              details = invoice.get_details.all

My data structure are set up as

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

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

  If there is any way to do this (other than as a straight postquel query)
  with a function, could someone please let me know.

  Thankyou for your thoughts


Alistair Ashcroft
Info Science Department
Infoal@otago.ac.nz
New Zealand
