pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rsmogura <rsmogura@softperience.eu>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Florian Pflug <fgp@phlo.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Lukas Eder <lukas.eder@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Date: Thu, 17 Feb 2011 13:18:30 +0100
Message-ID: <d955df8cad5299b45e7672972c7b9c45@mail.softperience.eu> (raw)
In-Reply-To: <4D5D0E4A.2020109@opencloud.com>
References: <c63c0e3d-cd3b-4b82-b891-50f8ef43bfdb@j25g2000vbs.googlegroups.com>
	<AANLkTi=Nf_eqY0Ao1W41rMc4vp-B6+8j+AENJ2x-qJ--@mail.gmail.com>
	<AANLkTikWLBniH-QRKa0AL+O71+DnTyizn770Hd89d5Lu@mail.gmail.com>
	<AANLkTi=0KS71rnnLjFrQ4G8VaOXsbYqndbmLStwL9aRt@mail.gmail.com>
	<AANLkTikNjPoca5n7CusTEL2GoXNQuZeeF0vyegpsz3UF@mail.gmail.com>
	<AANLkTikHdYF407NgX=giNEizY8Z2tcN47xkxuLBO73J=@mail.gmail.com>
	<4D5BBD1A.7010005@opencloud.com>
	<AANLkTimg0nEjma8MgFT-ZPrcQ7EHGZ4m2FZBhF5e+Hdt@mail.gmail.com>
	<4D5BC65D.8070507@opencloud.com>
	<A7BF4EA6-9385-! 47B3-B9BC-34649BBD4F6F@phlo.org>
	<24907.1297869823@sss.pgh.pa.us>
	<4D5C6876.7060805@opencloud.com>
	<AC9A9506-36C4-415A-9C1D-40CBB80C450A@phlo.org>
	<4D5CF52B.9020707@opencloud.com>
	<befa3498579f3abcc3d1e2e2b8579700@mail.softperience.eu>
	<4D5D012E.8030707@opencloud.com>
	<90b9defedf07d3c3732025d140897b57@mail.softperience.eu>
	<4D5D0A07.80706@opencloud.com>
	<f7d118eadd72401c99d71ab7d470149a@mail.softperience.eu>
	<4D5D0E4A.2020109@opencloud.com>

 <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".




view thread (48+ messages)  latest in thread

Message-ID: <d955df8cad5299b45e7672972c7b9c45@mail.softperience.eu>
Permalink:  ../d955df8cad5299b45e7672972c7b9c45@mail.softperience.eu/
Also on:    postgresql.org/message-id/d955df8cad5299b45e7672972c7b9c45@mail.softperience.eu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: rsmogura@softperience.eu, oliver@opencloud.com, fgp@phlo.org, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, lukas.eder@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
  In-Reply-To: <d955df8cad5299b45e7672972c7b9c45@mail.softperience.eu>
  References: <c63c0e3d-cd3b-4b82-b891-50f8ef43bfdb@j25g2000vbs.googlegroups.com> <AANLkTi=Nf_eqY0Ao1W41rMc4vp-B6+8j+AENJ2x-qJ--@mail.gmail.com> <AANLkTikWLBniH-QRKa0AL+O71+DnTyizn770Hd89d5Lu@mail.gmail.com> <AANLkTi=0KS71rnnLjFrQ4G8VaOXsbYqndbmLStwL9aRt@mail.gmail.com> <AANLkTikNjPoca5n7CusTEL2GoXNQuZeeF0vyegpsz3UF@mail.gmail.com> <AANLkTikHdYF407NgX=giNEizY8Z2tcN47xkxuLBO73J=@mail.gmail.com> <4D5BBD1A.7010005@opencloud.com> <AANLkTimg0nEjma8MgFT-ZPrcQ7EHGZ4m2FZBhF5e+Hdt@mail.gmail.com> <4D5BC65D.8070507@opencloud.com> <24907.1297869823@sss.pgh.pa.us> <4D5C6876.7060805@opencloud.com> <AC9A9506-36C4-415A-9C1D-40CBB80C450A@phlo.org> <4D5CF52B.9020707@opencloud.com> <befa3498579f3abcc3d1e2e2b8579700@mail.softperience.eu> <4D5D012E.8030707@opencloud.com> <90b9defedf07d3c3732025d140897b57@mail.softperience.eu> <4D5D0A07.80706@opencloud.com> <f7d118eadd72401c99d71ab7d470149a@mail.softperience.eu> <4D5D0E4A.2020109@opencloud.com> <d955df8cad5299b45e7672972c7b9c45@mail.softperience.eu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox