setting PreparedStatement parameter using "at time zone interval ?"

From: "Matt Magoffin" <postgresql(dot)org(at)msqr(dot)us>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: setting PreparedStatement parameter using "at time zone interval ?"
Date: 2007-12-19 09:18:25
Message-ID: 55255.192.168.1.108.1198055905.squirrel@msqr.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I'm using the latest 8.3 development driver against an 8.3 database. I
thought back in 8.1 I used to be able to use a PreparedStatement that
included something like

... date(l.created AT TIME ZONE INTERVAL ?)

but now I am always getting an exception like

org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1"

I found if I changed the query to use this syntax:

... date(timezone(?::interval, l.created))

it worked fine. Should the former syntax be supported by the JDBC driver?

-- m@

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Daniel Migowski 2007-12-19 14:40:12 TypeInfoCache
Previous Message Kris Jurka 2007-12-19 05:36:37 Re: Patch for Statement.getGeneratedKeys()