Re: Fwd: [JDBC] Weird issues when reading UDT from stored function - Mailing list pgsql-hackers

From rsmogura
Subject Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Date
Msg-id d955df8cad5299b45e7672972c7b9c45@mail.softperience.eu
Whole thread Raw
In response to Re: Fwd: [JDBC] Weird issues when reading UDT from stored function  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-hackers
 <snip>
>> 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".


pgsql-hackers by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Next
From: Gurjeet Singh
Date:
Subject: Re: Fix for Index Advisor related hooks