From: Tom Lane <tgl@sss.pgh.pa.us>
To: Carsten Friedrich <carsten@dtecht.com.au>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: JDBC 7.4 to 8.1 regression problem
Date: Fri, 14 Jul 2006 12:15:01 -0400
Message-ID: <21246.1152893701@sss.pgh.pa.us> (raw)
In-Reply-To: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop>
References: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop>
"Carsten Friedrich" <carsten@dtecht.com.au> writes:
> I use the following prepared statement:
> final static String SQL= "SELECT " +
> [...]
> " WHERE " +
> [...]
> + " AND service_date <= ?" +
> " and service_date > date ? - interval '365 days'; "
The above is broken code, and always has been: the fact that it failed
to malfunction back in 7.4 was purely accidental. You can only use the
syntax "typename literal" with a literal constant. Instead of "date ?"
use "?::date", or if you want to be fully SQL-spec-compliant write it
out as "CAST(? AS date)".
Actually, it'd probably be better to use "date_trunc('day', ?)" anyway,
since that's what you're trying to achieve with the cast.
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, carsten@dtecht.com.au
Subject: Re: JDBC 7.4 to 8.1 regression problem
In-Reply-To: <21246.1152893701@sss.pgh.pa.us>
References: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop> <21246.1152893701@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