Re: CVS JDBC driver will try to use server-side-prepare on unpreparable SQL - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: CVS JDBC driver will try to use server-side-prepare on unpreparable SQL
Date
Msg-id 18109.1060956393@sss.pgh.pa.us
Whole thread Raw
In response to CVS JDBC driver will try to use server-side-prepare on unpreparable SQL  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: CVS JDBC driver will try to use server-side-prepare on
List pgsql-jdbc
Oliver Jowett <oliver@opencloud.com> writes:
> It looks like the driver is trying to use server-side prepare on SQL that it
> won't work on:

Note that if you use the new-protocol Parse message, you can prepare
any SQL command.

I was thinking yesterday that it would not take very much more work
to make the PREPARE SQL command accept any SQL command after it, too.
But that's close enough to a new feature that I wasn't gonna do it
for 7.4.  If you feel it's important for the JDBC driver then we can
talk about it.  (Neither of these things would help you on a pre-7.4
server, of course, so maybe you need a different approach anyhow.)

> Should we only be doing PREPARE on queries that are known to be safe (e.g.
> single-statement SELECTs), or is it better to try to catch the errors and
> abandon the prepare? (more general, but sounds a bit hairy).

Uh, don't you have to be prepared to catch errors in PREPARE anyway?
What if the command is syntactically or semantically wrong?

            regards, tom lane

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: CVS JDBC driver will try to use server-side-prepare on unpreparable SQL
Next
From: Peter Royal
Date:
Subject: Debugging I/O errors occured while reading from backend