Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 7EFE41336FA7 for ; Thu, 17 Feb 2011 08:18:32 -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 39245-06; Thu, 17 Feb 2011 12:18:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.softperience.eu (static-ip-217-118-26-141.inaddr.intergenia.de [217.118.26.141]) by mail.postgresql.org (Postfix) with ESMTP id 6B1411337BCC; Thu, 17 Feb 2011 08:18:24 -0400 (AST) Received: from mail.softperience.eu (static-ip-217-118-26-141.inaddr.intergenia.de [217.118.26.141]) by mail.softperience.eu (Postfix) with ESMTPA id BA51AC000B1; Thu, 17 Feb 2011 13:18:30 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 17 Feb 2011 13:18:30 +0100 From: rsmogura To: Oliver Jowett Cc: Florian Pflug , Tom Lane , Robert Haas , Lukas Eder , , Subject: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function In-Reply-To: <4D5D0E4A.2020109@opencloud.com> References: <4D5BBD1A.7010005@opencloud.com> <4D5BC65D.8070507@opencloud.com> <24907.1297869823@sss.pgh.pa.us> <4D5C6876.7060805@opencloud.com> <4D5CF52B.9020707@opencloud.com> <4D5D012E.8030707@opencloud.com> <90b9defedf07d3c3732025d140897b57@mail.softperience.eu> <4D5D0A07.80706@opencloud.com> <4D5D0E4A.2020109@opencloud.com> Message-ID: X-Sender: rsmogura@softperience.eu User-Agent: Roundcube Webmail/0.5-rc X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.89 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_FILL_THIS_FORM_SHORT=0.01 X-Spam-Level: X-Archive-Number: 201102/1665 X-Sequence-Number: 182454 >> testdb=# CREATE FUNCTION p_enhance_address4 (address OUT >> u_address_type) AS $$ BEGIN address := (SELECT t_author.address FROM >> t_author WHERE first_name = 'George'); END; $$ LANGUAGE plpgsql; >> CREATE FUNCTION >> testdb=# SELECT * FROM p_enhance_address4(); >> street | zip | city | country | since >> | code >> >> ------------------------+--------+-----------+---------+------------+------ >> ("Parliament Hill",77) | NW31A9 | Hampstead | England | 1980-01-01 >> | >> (1 row) > > The second problem is that the JDBC driver always generates calls in > the > "SELECT * FROM ..." form, but this does not work correctly for > one-OUT-parameter-that-is-a-UDT, as seen in the example immediately > above. Here's how to do the call for that particular case: > >> testdb=# SELECT p_enhance_address4(); >> p_enhance_address4 >> ------------------------------------------------------------------- >> ("(""Parliament Hill"",77)",NW31A9,Hampstead,England,1980-01-01,) >> (1 row) > > The challenge is that the bare SELECT form doesn't work for multiple > OUT > parameters, so the driver has to select one form or the other based > on > the number of OUT parameters. > > Any questions? (I'm sure there will be questions. Sigh.) > > Oliver I don't want to blame or anything similar, any idea is good, as any effort as well, but if user will register one output parameter, but procedure will have two will it be possible to check this? I'm little lost in this nested records. If there will be no such check I suggest to configure this by connection parameter, because in any way UDTs aren't such popular, user should have choice to decide "I want better checks", or "I need this! Everything is on my side".