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

From: rsmogura <rsmogura(at)softperience(dot)eu>
To: Lukas Eder <lukas(dot)eder(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Oliver Jowett <oliver(at)opencloud(dot)com>, <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-16 12:12:22
Message-ID: 0f6ba03b13a86472a2a8825bcf1c5811@mail.softperience.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

If I may give some suggestion, I was tried to investigate this, and
maybe some this will help
When you create procedure with out parameters then return type of this
is implicit calculated and may be
record or base type (if exactly one out param is defined).

In many places I saw comparison of return type to recordoid or complex
type, but check against complex type is through pg_types only, if
typtype is marked 'c'. Unfortunately both rows and STRUCT (complex) has
there 'c' - and this is OK for situation when procedure will return
"table". But for complex types not being recordoid I think additional
check should go. I mean to use get_rel_relkind() and e.g. check if it is
pure complex type.

By the way,
Actually, based on above I saw funny things - I can create table with
column type being other table :) And now If my one output parameter will
be of complex type and relkind row type, what should I get?

On Wed, 16 Feb 2011 09:30:43 +0100, Lukas Eder wrote:
> I'm not trying to fix the signature. I want exactly that signature. I
> want to return 1 UDT as an OUT parameter from a function.
>
> Somewhere between JDBC and the database, this signature is lost, and
> JDBC's internal code tells me that I have to bind 6 OUT parameters,
> instead of 1. It happens to be so, because the UDT contains 6
> attributes, so somehow the JDBC/database protocol flattens the UDT,
> and I think that's a bug, either in JDBC or in the protocol or in the
> database. My findings were that I can correctly read the UDT OUT
> parameter using the pgAdmin III tool, so I excluded the database as a
> bug holder candidate.
>
> Cheers
> Lukas
>
> 2011/2/15 Robert Haas
>
>> On Sat, Feb 12, 2011 at 6:16 AM, Lukas Eder wrote:
>> > I had tried that before. That doesn't seem to change anything.
>> JDBC still
>> > expects 6 OUT parameters, instead of just 1...
>>
>> Oh, hrm.  I thought you were trying to fix the return value,
>> rather
>> than the signature.
>>
>> I am not sure how to fix the signature.  Can you just make it
>> return RECORD?
>>
>> --
>>
>> Robert Haas
>> EnterpriseDB: http://www.enterprisedb.com [2]
>> The Enterprise PostgreSQL Company
>
>
>
> Links:
> ------
> [1] mailto:lukas(dot)eder(at)gmail(dot)com
> [2] http://www.enterprisedb.com
> [3] mailto:robertmhaas(at)gmail(dot)com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Eder 2011-02-16 12:12:42 Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Previous Message Robert Haas 2011-02-16 12:11:32 Re: Fwd: [JDBC] Weird issues when reading UDT from stored function

Browse pgsql-jdbc by date

  From Date Subject
Next Message Lukas Eder 2011-02-16 12:12:42 Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Previous Message Robert Haas 2011-02-16 12:11:32 Re: Fwd: [JDBC] Weird issues when reading UDT from stored function