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

It looks like the driver is trying to use server-side prepare on SQL that it
won't work on:

Aug 16 00:05:40 flood postgres[12989]: [12-1] LOG:  query: PREPARE JDBC_STATEMENT_4 AS CREATE TABLE
"testBigDB/persisted_testBigDB/persisted_one"( pk         BYTEA   NOT 
Aug 16 00:05:40 flood postgres[12989]: [12-2]  NULL,  generation INT8    NOT NULL,  data       BYTEA   NOT NULL,
CONSTRAINT
Aug 16 00:05:40 flood postgres[12989]: [12-3]  "pkey_testBigDB/persisted_testBigDB/persisted_one" PRIMARY KEY (pk));
EXECUTEJDBC_STATEMENT_4 
Aug 16 00:05:40 flood postgres[12989]: [13] ERROR:  parser: parse error at or near "CREATE" at character 29

This then turns up as a SQLException on the java side.

Yes, I know, "don't do that then!", but isn't the plan to default to
server-side prepare eventually?

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

The reason that this came up is I'm modifying the driver to allow
server-side prepare to be toggled at the connection- and datasource- level.
Patches for that to follow once I've sorted this problem out.

-O

pgsql-jdbc by date:

Previous
From: "Robert Maye"
Date:
Subject: Re: jdbc driver for jbuilder
Next
From: Tom Lane
Date:
Subject: Re: CVS JDBC driver will try to use server-side-prepare on unpreparable SQL