Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id ECD4E63587A for ; Fri, 3 Apr 2009 16:10:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 94089-07 for ; Fri, 3 Apr 2009 16:10:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp1.islandnet.com (smtp1.islandnet.com [199.175.106.100]) by mail.postgresql.org (Postfix) with ESMTP id 6E21F635140 for ; Fri, 3 Apr 2009 16:10:04 -0300 (ADT) Received: from [199.175.106.52] (port=34837 helo=cluster.islandnet.com) by smtpout.islandnet.com with ESMTP id 1LpomB-000JXC-7l ; Fri, 03 Apr 2009 12:10:03 -0700 Received: from [24.108.1.50] (port=3983 helo=[192.168.0.193]) by cluster03.islandnet.com with ESMTPSA (TLSv1:AES256-SHA:256) id 1LpomB-0001tU-A2 ; Fri, 03 Apr 2009 12:10:03 -0700 Message-ID: <49D65F0A.70107@borstad.com> Date: Fri, 03 Apr 2009 12:10:02 -0700 From: Peter Willis Reply-To: peterw@borstad.com User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Adrian Klaver CC: pgsql-sql@postgresql.org Subject: Re: FUNCTION problem References: <1381545833.2939121238777956737.JavaMail.root@sz0030a.emeryville.ca.mail.comcast.net> In-Reply-To: <1381545833.2939121238777956737.JavaMail.root@sz0030a.emeryville.ca.mail.comcast.net> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/36 X-Sequence-Number: 32382 Adrian Klaver wrote: > > > If you are using Postgres 8.1+ then it becomes even easier because you can use OUT parameters in the function argument list to eliminate the "as test(c1 int,c2 int)" clause. At this point it becomes a A-->B-->C problem i.e determine what your inputs are, how you want to process them and how you want to return the output. > '8.1+'?? Hmmm, I'm using 8.3. I could use that. I got the more complex version of the query to work by backing away from 'plpgsql' as the language and using 'sql' instead. I then nested (terribly ugly) my select statements to generate a single SQL query from all. This allows me to change the output of the query without needing to define a new set of output 'OUT' parameters each time I change things. I have use of the 'OUT' parameters with another set of functions though. Thanks for that. Peter