Re: Fwd: [JDBC] Weird issues when reading UDT from stored function

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Florian Pflug <fgp(at)phlo(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Lukas Eder <lukas(dot)eder(at)gmail(dot)com>, rsmogura <rsmogura(at)softperience(dot)eu>, pgsql-jdbc(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Date: 2011-02-17 00:14:46
Message-ID: 4D5C6876.7060805@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On 17/02/11 04:23, Tom Lane wrote:
> Florian Pflug <fgp(at)phlo(dot)org> 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-02-17 00:25:54 Re: Fix for Index Advisor related hooks
Previous Message Robert Haas 2011-02-17 00:07:29 Re: Add support for logging the current role

Browse pgsql-jdbc by date

  From Date Subject
Next Message rsmogura 2011-02-17 09:30:51 Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Previous Message RW Shore 2011-02-16 17:40:12 Re: Array of box not supported?