Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 0257B1337B4F for ; Thu, 17 Feb 2011 08:08:18 -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 65139-03 for ; Thu, 17 Feb 2011 12:08:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from master.phlo.org (master.phlo.org [213.47.213.180]) by mail.postgresql.org (Postfix) with ESMTP id 107181337BCC for ; Thu, 17 Feb 2011 08:08:09 -0400 (AST) Received: (qmail 28400 invoked by uid 0); 17 Feb 2011 12:08:07 -0000 Received: from chello062178190165.2.15.vie.surfer.at (HELO [192.168.1.15]) (fgp@[62.178.190.165]) (envelope-sender ) by imap.phlo.org (qmail-ldap-1.03) with SMTP for ; 17 Feb 2011 12:08:07 -0000 Subject: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Florian Pflug In-Reply-To: <4D5CF52B.9020707@opencloud.com> Date: Thu, 17 Feb 2011 13:08:06 +0100 Cc: Tom Lane , Robert Haas , Lukas Eder , rsmogura , pgsql-jdbc@postgresql.org, pgsql-hackers@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <4d7cc4033a655539995c240a6f282ab5@mail.softperience.eu> <4D33CD00.6000408@opencloud.com> <4D5BBD1A.7010005@opencloud.com> <4D5BC65D.8070507@opencloud.com> <24907.1297869823@sss.pgh.pa.us> <4D5C6876.7060805@opencloud.com> <4D5CF52B.9020707@opencl oud.com> To: Oliver Jowett X-Mailer: Apple Mail (2.1082) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/1663 X-Sequence-Number: 182452 On Feb17, 2011, at 11:15 , Oliver Jowett wrote: > Florian Pflug wrote: >> On Feb17, 2011, at 01:14 , Oliver Jowett wrote: >>> 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. >> There's no sane way to do that, I fear. You could of course look up = the >> function definition in the catalog before actually calling it, but = with >> overloading and polymorphic types finding the right pg_proc entry = seems >> awfully complex. >> Your best option is probably to just document this caveat... >=20 > Well, the JDBC driver does know how many OUT parameters there are = before execution happens, so it could theoretically do something = different for 1 OUT vs. many OUT parameters. Right, I had forgotten that JDBC must be told about OUT parameter with = registerOutputType() > The problem is that currently the translation of the JDBC "{ call }" = escape happens early on, well before we know which parameters are OUT = parameters. Moving that translation later is, at best, tricky, so I was = hoping there was one query form that would handle all cases. Hm, now I'm confused. Even leaving the single-OUT-parameter problem = aside, the JDBC statement {call f(?,?)} either translates to SELECT * FROM f($1) or SELECT * FROM f($1, $2) depending on whether one of the parameter is OUT. Without knowing the = number of output parameters, how do you distinguish these two cases? best regards, Florian Pflug