CVS JDBC driver will try to use server-side-prepare on unpreparable SQL

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: CVS JDBC driver will try to use server-side-prepare on unpreparable SQL
Date: 2003-08-15 12:17:45
Message-ID: 20030815121744.GC10588@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)); EXECUTE JDBC_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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2003-08-15 14:06:33 Re: CVS JDBC driver will try to use server-side-prepare on unpreparable SQL
Previous Message Richard Froud 2003-08-15 09:10:45 JDBC getImortedKeys() getExportedKeys() incorrect ON DELETE property