X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 0915A9FB32F for ; Fri, 14 Jul 2006 13:15:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 40149-07 for ; Fri, 14 Jul 2006 13:15:19 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 3DB829FB2E3 for ; Fri, 14 Jul 2006 13:15:19 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6EGF1Zc021247; Fri, 14 Jul 2006 12:15:01 -0400 (EDT) To: "Carsten Friedrich" cc: pgsql-jdbc@postgresql.org Subject: Re: JDBC 7.4 to 8.1 regression problem In-reply-to: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop> References: <005a01c6a6e9$6b358c20$1500a8c0@carstenlaptop> Comments: In-reply-to "Carsten Friedrich" message dated "Fri, 14 Jul 2006 12:01:28 +1000" Date: Fri, 14 Jul 2006 12:15:01 -0400 Message-ID: <21246.1152893701@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/61 X-Sequence-Number: 15487 "Carsten Friedrich" 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