pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matt Magoffin <postgresql.org@msqr.us>
To: pgsql-jdbc@postgresql.org
Subject: setting PreparedStatement parameter using "at time zone interval ?"
Date: Wed, 19 Dec 2007 22:18:25 +1300 (NZDT)
Message-ID: <55255.192.168.1.108.1198055905.squirrel@msqr.us> (raw)

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@



view thread (3+ messages)  latest in thread

Message-ID: <55255.192.168.1.108.1198055905.squirrel@msqr.us>
Permalink:  ../55255.192.168.1.108.1198055905.squirrel@msqr.us/
Also on:    postgresql.org/message-id/55255.192.168.1.108.1198055905.squirrel@msqr.us

 · 

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: postgresql.org@msqr.us
  Subject: Re: setting PreparedStatement parameter using "at time zone interval ?"
  In-Reply-To: <55255.192.168.1.108.1198055905.squirrel@msqr.us>
  References: <55255.192.168.1.108.1198055905.squirrel@msqr.us>

* 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