From: Thomas Hallgren <thhal@mailblocks.com>
To: Oliver Jowett <oliver@opencloud.com>
Cc: Larry White <ljw1001@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: prepared statement call fails
Date: Sun, 05 Dec 2004 23:53:29 +0100
Message-ID: <thhal-07imPAsuIcC461y0nbDufqKvsZZFNwJ@mailblocks.com> (raw)
In-Reply-To: <41B37F31.1070205@opencloud.com>
References: <d15ea14a0412051050399cd69b@mail.gmail.com>
<41B35CC6.2030800@mailblocks.com>
<d15ea14a04120511366efd4b9c@mail.gmail.com>
<41B3663B.1010003@mailblocks.com>
<thhal-0vf6OAs2HcC4EOCO9kFe0y/p7mAxh7m@mailblocks.com>
<thhal-0vv6OAs+HcC4bv5Tf2D5MH8fUmr8Wr9@mailblocks.com>
<41B37F31.1070205@opencloud.com>
<41B39169.2060308@mailblocks.com>
<thhal-07imPAseIcC4Dwrlj3jsQjacxd46QTg@mailblocks.com>
<thhal-07imPAsmIcC42P9NCGBSs3Et5WguggA@mailblocks.com>
Oliver Jowett wrote:
> Please explain the difference between a PostgreSQL value-returning
> function and a stored procedure that returns a value and takes no OUT
> parameters.
>
> The {? = call ...} syntax is standard. I don't see any reason not to
> map it to PostgreSQL functions for the cases that make sense.
What will the JDBC driver do when PostgreSQL implements real stored
procedures? If it maintains the current mapping for this syntax, it will
not be able to call real procedures. If the mapping is changed to
accomodate PERFORM, all current code that relies on this behavior will fail.
There are also other differences. A CallableStatement should be prepared
to accept multiple result set's as a return value, a CallableStatement
might have multiple OUT parameters, and the auto commit semantics are
different since stored procedures are allowed to start and end top level
transactions.
> If the server makes changes that are not backwards-compatible, of
> course old drivers are going to break. But a) those sort of changes
> are rare and b) the same argument holds true for *everything* in the
> driver.
In this case, the server will implement something that wasn't there
before so there will not be any compatibility breakage. But since the
JDBC driver use CallableStatement for something that it wasn't intended
for, the special mapping it performs will become a problem now that the
real thing exists.
Then again, perhaps the behavior can be controlled by consulting the
system tables and map according to that? It will take a roundtrip extra
to figure out on the first call but that shouldn't be to big a deal.
Regards,
Thomas Hallgren
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: thhal@mailblocks.com, oliver@opencloud.com, ljw1001@gmail.com
Subject: Re: prepared statement call fails
In-Reply-To: <thhal-07imPAsuIcC461y0nbDufqKvsZZFNwJ@mailblocks.com>
References: <d15ea14a0412051050399cd69b@mail.gmail.com> <41B35CC6.2030800@mailblocks.com> <d15ea14a04120511366efd4b9c@mail.gmail.com> <41B3663B.1010003@mailblocks.com> <thhal-0vf6OAs2HcC4EOCO9kFe0y/p7mAxh7m@mailblocks.com> <thhal-0vv6OAs+HcC4bv5Tf2D5MH8fUmr8Wr9@mailblocks.com> <41B37F31.1070205@opencloud.com> <41B39169.2060308@mailblocks.com> <thhal-07imPAseIcC4Dwrlj3jsQjacxd46QTg@mailblocks.com> <thhal-07imPAsmIcC42P9NCGBSs3Et5WguggA@mailblocks.com> <thhal-07imPAsuIcC461y0nbDufqKvsZZFNwJ@mailblocks.com>
* 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