pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Nick Johnson <pgsql@spatula.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: 8.0.3 parse errors where 7.x was ok
Date: Tue, 9 Aug 2005 19:05:09 -0500 (EST)
Message-ID: <Pine.BSO.4.56.0508091900580.21747@leary.csoft.net> (raw)
In-Reply-To: <20050809164256.D7871@turing.morons.org>
References: <20050809164256.D7871@turing.morons.org>



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



view thread (3+ messages)  latest in thread

Message-ID: <Pine.BSO.4.56.0508091900580.21747@leary.csoft.net>
Permalink:  ../Pine.BSO.4.56.0508091900580.21747@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.56.0508091900580.21747@leary.csoft.net

 · 

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: books@ejurka.com, pgsql@spatula.net
  Subject: Re: 8.0.3 parse errors where 7.x was ok
  In-Reply-To: <Pine.BSO.4.56.0508091900580.21747@leary.csoft.net>
  References: <20050809164256.D7871@turing.morons.org> <Pine.BSO.4.56.0508091900580.21747@leary.csoft.net>

* 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