From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matt Magoffin <postgresql.org@msqr.us>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: setting PreparedStatement parameter using "at time zone interval ?"
Date: Wed, 19 Dec 2007 10:48:45 -0500
Message-ID: <23204.1198079325@sss.pgh.pa.us> (raw)
In-Reply-To: <55255.192.168.1.108.1198055905.squirrel@msqr.us>
References: <55255.192.168.1.108.1198055905.squirrel@msqr.us>
"Matt Magoffin" <postgresql.org@msqr.us> writes:
> 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 ?)
That might've worked back before the driver did real prepared
statements. It's invalid syntax though, because typename before the
constant works only for simple literal string constants. You got away
with it when the driver interpolated parameter values into the query as
string literals, but you can't do it anymore.
?::interval (or the full-blown CAST syntax) is the right way.
See
http://developer.postgresql.org/pgdocs/postgres/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS
particularly 4.1.2.5.
regards, tom lane
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: tgl@sss.pgh.pa.us, postgresql.org@msqr.us
Subject: Re: setting PreparedStatement parameter using "at time zone interval ?"
In-Reply-To: <23204.1198079325@sss.pgh.pa.us>
References: <55255.192.168.1.108.1198055905.squirrel@msqr.us> <23204.1198079325@sss.pgh.pa.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