Re: Problem with 8.1 driver - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Problem with 8.1 driver
Date
Msg-id Pine.BSO.4.61.0512051715450.781@leary.csoft.net
Whole thread Raw
In response to Problem with 8.1 driver  ("Michael Paesold" <mpaesold@gmx.at>)
List pgsql-jdbc

On Mon, 5 Dec 2005, Michael Paesold wrote:

> 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.
>
> String DELETE_QUERY = "DELETE FROM server_log WHERE level_value"
>   + " <= ? AND event_time < NOW() - interval ?";
>

The syntax "interval ?" may not be used in prepared queries.  This is a
limitation of the backend which you can see using PREPARE/EXECUTE at the
SQL level.  The 8.0 driver started using true prepared queries instead of
directly interpolating parameter values and issuing a regular sql
statement.  You must use "CAST(? AS INTERVAL)" or "?::interval".

Kris Jurka

pgsql-jdbc by date:

Previous
From: "Michael Paesold"
Date:
Subject: Problem with 8.1 driver
Next
From: Damon Anderson
Date:
Subject: bug with 8.X level 4 driver?