Return-Path: postman 
Delivery-Date: Tue, 14 Sep 93 18:39:53 PDT
Return-Path: postman
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA12586; Tue, 14 Sep 93 18:32:10 -0700
Resent-From: postman (POSTGRES mailing list)
Resent-Message-Id: <9309150132.AA12586@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 AA12578; Tue, 14 Sep 93 18:31:58 -0700
Received: from rivendell.otago.ac.nz by rivendell.otago.ac.nz (PMDF #12052) id
 <01H2Z96PV1QCB3KGU6@rivendell.otago.ac.nz>; Wed, 15 Sep 1993 13:29 +1300
Date: Wed, 15 Sep 1993 13:29 +1300
From: INFOAL@rivendell.otago.ac.nz
Subject: Simple query
To: Postgres@postgres.berkeley.EDU
Message-Id: <01H2Z96PV1QCB3KGU6@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: Tue, 14 Sep 93 18:32:08 PDT

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
Infos
Infoal@otago.ac.nz
New Zealand
