Re: Make procedure OUT parameters work with JDBC - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Make procedure OUT parameters work with JDBC
Date
Msg-id 7462f9f9-116f-71ba-87e2-f72f0e9812b7@dunslane.net
Whole thread Raw
In response to Re: Make procedure OUT parameters work with JDBC  (Craig Ringer <craig.ringer@enterprisedb.com>)
List pgsql-hackers
On 10/19/20 8:35 PM, Craig Ringer wrote:
>
>
> On Mon, 19 Oct 2020, 19:16 Andrew Dunstan, <andrew@dunslane.net
> <mailto:andrew@dunslane.net>> wrote:
>
>
>     On 10/19/20 5:19 AM, Peter Eisentraut wrote:
>     > A follow-up to the recently added support for OUT parameters for
>     > procedures.  The JDBC driver sends OUT parameters with type void. 
>     > This makes sense when calling a function, so that the parameters are
>     > ignored in ParseFuncOrColumn().  For a procedure call we want to
>     treat
>     > them as unknown.  This is of course a bit of a hack on top of
>     another
>     > hack, but it's small and contained and gets the job done.
>     >
>
>
> The JDBC spec defines CallableStatement.registerOutPararameter(...)
> variants that take SQLType enumeration value and optionally type name.
>
> It's important that this change not break correct and fully specified
> use of the CallableStatement interface.


The JDBC driver currently implements this but discards any type
information and sends VOIDOID. This patch accommodates that. This
actually works fine, except in the case of overloaded procedures, where
the workaround is to include an explicit cast in the CALL statement.

Modifying the JDBC driver to send real type info for these cases is
something to be done, but there are some difficulties in that the class
where it's handled doesn't have enough context. And there will also
always be cases where it really doesn't know what to send (user defined
types etc.), so sending VOIDOID or UNKNOWNOID will still be done.


cheers


andrew


--
Andrew Dunstan
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company




pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: Wired if-statement in gen_partprune_steps_internal
Next
From: Amit Langote
Date:
Subject: Re: partition routing layering in nodeModifyTable.c