Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 770161337B4E for ; Wed, 16 Feb 2011 20:15:33 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 87376-02; Thu, 17 Feb 2011 00:15:25 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id 45293133616B; Wed, 16 Feb 2011 20:15:25 -0400 (AST) Received: from 121-98-80-66.bitstream.orcon.net.nz ([121.98.80.66] helo=[192.168.1.2]) by tremor.opencloud.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PprWS-0004Mm-2b; Thu, 17 Feb 2011 13:15:04 +1300 Message-ID: <4D5C6876.7060805@opencloud.com> Date: Thu, 17 Feb 2011 13:14:46 +1300 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Tom Lane CC: Florian Pflug , Robert Haas , Lukas Eder , rsmogura , pgsql-jdbc@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function References: <201101111946.33083.rsmogura@softperience.eu> <4d7cc4033a655539995c240a6f282ab5@mail.softperience.eu> <4D33CD00.6000408@opencloud.com> <4D5BBD1A.7010005@opencloud.com> <4D5BC65D.8070507@opencloud.com> <24907.1297869823@sss.pgh.pa. us> In-Reply-To: <24907.1297869823@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201102/1582 X-Sequence-Number: 182371 On 17/02/11 04:23, Tom Lane wrote: > Florian Pflug writes: >> Hm, I've browsed through the code and it seems that the current behaviour >> was implemented on purpose. > > Yes, it's 100% intentional. The idea is to allow function authors to > use OUT-parameter notation (in particular, the convention of assigning > to a named variable to set the result) without forcing them into the > overhead of returning a record when all they want is to return a scalar. > So a single OUT parameter is *supposed* to work just like a function > that does "returns whatever" without any OUT parameters. > > Even if you think this was a bad choice, which I don't, it's far too > late to change it. Any suggestions about how the JDBC driver can express the query to get the behavior that it wants? Specifically, the driver wants to call a particular function with N OUT or INOUT parameters (and maybe some other IN parameters too) and get a resultset with N columns back. The current approach is to say "SELECT * FROM f(params) AS RESULT" which works in all cases *except* for the case where there is exactly one OUT parameter and it has a record/UDT type. Oliver