Re: Make procedure OUT parameters work with JDBC

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Craig Ringer <craig(dot)ringer(at)enterprisedb(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Make procedure OUT parameters work with JDBC
Date: 2020-10-20 12:55:37
Message-ID: 7462f9f9-116f-71ba-87e2-f72f0e9812b7@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 10/19/20 8:35 PM, Craig Ringer wrote:
>
>
> On Mon, 19 Oct 2020, 19:16 Andrew Dunstan, <andrew(at)dunslane(dot)net
> <mailto:andrew(at)dunslane(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2020-10-20 12:57:31 Re: partition routing layering in nodeModifyTable.c
Previous Message Amit Langote 2020-10-20 12:46:44 Re: Wired if-statement in gen_partprune_steps_internal