Re: 8.0.3 parse errors where 7.x was ok

From: Kris Jurka <books(at)ejurka(dot)com>
To: Nick Johnson <pgsql(at)spatula(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: 8.0.3 parse errors where 7.x was ok
Date: 2005-08-10 00:05:09
Message-ID: Pine.BSO.4.56.0508091900580.21747@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, 9 Aug 2005, Nick Johnson wrote:

> I'm getting a new exception when upgrading to Postgres 8.0.3 with the JDBC
> drivers it builds:
>
> java.sql.SQLException: ERROR: parse error at or near "$1"
>
> 105 try {
> 106 s = c.prepareStatement("select now() - interval ?");
> 107 s.setString(1, "7 days");
> 108 ResultSet r = s.executeQuery();
>
> Is this syntax no longer supported?
>

Yes. The 8.0 driver always uses server side prepared statements when in
the past the statements were usually put together on the driver side.
The using a type prefix (like "interval") is not supported in server
prepared statements, so this is a server limitation that is now exposed
with the new driver. I believe "?::interval" or "cast(? as interval)"
should work.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-08-10 00:17:11 Re: 8.0.3 parse errors where 7.x was ok
Previous Message Nick Johnson 2005-08-09 23:53:40 8.0.3 parse errors where 7.x was ok