pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Florian Pflug <fgp@phlo.org>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Lukas Eder <lukas.eder@gmail.com>
Cc: rsmogura <rsmogura@softperience.eu>
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:08:06 +0100
Message-ID: <FBF0DBB7-3529-4D6B-BDA4-4FD4212F48A0@phlo.org> (raw)
In-Reply-To: <4D5CF52B.9020707@opencloud.com>
References: <c63c0e3d-cd3b-4b82-b891-50f8ef43bfdb@j25g2000vbs.googlegroups.com>
	<4d7cc4033a655539995c240a6f282ab5@mail.softperience.eu>
	<AANLkTi=EAbWpOZhXUaG0OG7smtExwoE4M9dv2ykzPVcZ@mail.gmail.com>
	<4D33CD00.6000408@opencloud.com>
	<AANLkTin_UwaAjVKOqY3ZGpHtEt4WiX8f-ERJhA16JWX+@mail.gmail.com>
	<AANLkTimvqQmkvG0QcruFGGxCrQ63U8srtDtMZBH8WjQU@mail.gmail.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@opencl oud.com>

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




view thread (48+ messages)  latest in thread

Message-ID: <FBF0DBB7-3529-4D6B-BDA4-4FD4212F48A0@phlo.org>
Permalink:  ../FBF0DBB7-3529-4D6B-BDA4-4FD4212F48A0@phlo.org/
Also on:    postgresql.org/message-id/FBF0DBB7-3529-4D6B-BDA4-4FD4212F48A0@phlo.org

 · 

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: fgp@phlo.org, oliver@opencloud.com, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, lukas.eder@gmail.com, rsmogura@softperience.eu, pgsql-hackers@postgresql.org
  Subject: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
  In-Reply-To: <FBF0DBB7-3529-4D6B-BDA4-4FD4212F48A0@phlo.org>
  References: <c63c0e3d-cd3b-4b82-b891-50f8ef43bfdb@j25g2000vbs.googlegroups.com> <4d7cc4033a655539995c240a6f282ab5@mail.softperience.eu> <AANLkTi=EAbWpOZhXUaG0OG7smtExwoE4M9dv2ykzPVcZ@mail.gmail.com> <4D33CD00.6000408@opencloud.com> <AANLkTin_UwaAjVKOqY3ZGpHtEt4WiX8f-ERJhA16JWX+@mail.gmail.com> <AANLkTimvqQmkvG0QcruFGGxCrQ63U8srtDtMZBH8WjQU@mail.gmail.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> <FBF0DBB7-3529-4D6B-BDA4-4FD4212F48A0@phlo.org>

* 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