Re: BUG #2036: 8.1 JDBC busted date with INTERVAL update

From: Kris Jurka <books(at)ejurka(dot)com>
To: Reuben Pasquini <pasquini(at)imageworks(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2036: 8.1 JDBC busted date with INTERVAL update
Date: 2005-11-22 00:45:45
Message-ID: Pine.BSO.4.61.0511211943340.23138@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 11 Nov 2005, Reuben Pasquini wrote:

> Bug reference: 2036
> Description: 8.1 JDBC busted date with INTERVAL update
> Details:
>
> Something like this would work with the postgres-7.4
> jdbc3.jar driver, but fails with the shown error with
> postgres-8.1 jdbc3.jar driver.
> Running with a non-prepared statement works
> with 8.1.
> I'm running 8.1 server on linux, jdk1.5.
> Not sure if this is a bug, or intentional.
>
> s_query = "UPDATE cue.proc SET dt_started = now() - INTERVAL ? WHERE pk=5";
> x_stmt = x_conn.prepareStatement ( s_query );
> x_stmt.setString ( 1, "0 seconds" );
>

This is a known limitation of server side prepared statements (which were
added in the 8.0 JDBC driver). You may not use the syntax "INTERVAL ?",
but must instead use "CAST(? AS INTERVAL)" or "?::interval".

Kris Jurka

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message neeraj chaudhari 2005-11-22 06:28:08 BUG #2063: Unsupported frontend protocol
Previous Message Kris Jurka 2005-11-22 00:42:36 Re: BUG #2060: Issue with Data base connection