pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paesold <mpaesold@gmx.at>
To: pgsql-jdbc@postgresql.org
Subject: Problem with 8.1 driver
Date: Mon, 5 Dec 2005 21:27:34 +0100
Message-ID: <024401c5f9da$537c29c0$0f01a8c0@zaphod> (raw)

Hi,

I am running postgresql-8.1-404.jdbc3.jar against server version 7.4.7, 
which I want to eventually upgrade to 8.1.

Right now I am testing our application with the 8.1 driver and found an 
issue with a prepared query. (Btw. I am using a regular connection URL 
without any special parameters set.)

The offending code looks like this:

String DELETE_QUERY = "DELETE FROM server_log WHERE level_value"
    + " <= ? AND event_time < NOW() - interval ?";

PreparedStatement stmt = con.prepareStatement(DELETE_QUERY);
stmt.setInt(1, level.intValue());
stmt.setString(2, "1 day");

int deleted = stmt.executeUpdate();

Using the 7.4 driver this worked just fine. Now with the new driver I get:
org.postgresql.util.PSQLException: ERROR: syntax error at or near "$2"
at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512)
at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346)
at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:300)
...

Server statement log shows:
DELETE FROM server_log WHERE level_value <= $1 AND event_time < NOW() - 
interval $2

Is this a bug, or is the driver just not compatible with the server? Should 
not be so because both speak the V3 protocol. Thanks for your help.

Best Regards,
Michael Paesold 





view thread (7+ messages)  latest in thread

Message-ID: <024401c5f9da$537c29c0$0f01a8c0@zaphod>
Permalink:  ../024401c5f9da$537c29c0$0f01a8c0@zaphod/
Also on:    postgresql.org/message-id/024401c5f9da$537c29c0$0f01a8c0@zaphod

 · 

reply

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: mpaesold@gmx.at
  Subject: Re: Problem with 8.1 driver
  In-Reply-To: <024401c5f9da$537c29c0$0f01a8c0@zaphod>
  References: <024401c5f9da$537c29c0$0f01a8c0@zaphod>

* 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