X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 22EB8DB14B for ; Thu, 27 Oct 2005 21:29:22 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10846-01 for ; Fri, 28 Oct 2005 00:29:18 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by svr1.postgresql.org (Postfix) with ESMTP id 6C59ADB15A for ; Thu, 27 Oct 2005 21:29:19 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EVI7W-0000yu-A6; Fri, 28 Oct 2005 13:29:22 +1300 Message-ID: <436170E1.6000909@opencloud.com> Date: Fri, 28 Oct 2005 13:29:21 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051009) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matt Magoffin Cc: pgsql-jdbc@postgresql.org Subject: Re: INTERVAL parameter in PreparedStatement worked in 7.4 References: <50387.219.89.94.58.1130457365.squirrel@msqr.us> In-Reply-To: <50387.219.89.94.58.1130457365.squirrel@msqr.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.333 required=5 tests=[AWL=-0.318, SUBJ_HAS_SPACES=0.651] X-Spam-Score: 0.333 X-Spam-Level: X-Archive-Number: 200510/140 X-Sequence-Number: 14071 Matt Magoffin wrote: > I used to use the following style statement with the 7.4 series JDBC driver: > > select * from users users where users.createdDate < (CURRENT_DATE - > INTERVAL ?) > > and would set the parameter to a string value of "14 DAYS" > > but in the Postgres 8 driver, this query executes but does not seem to > ever return anything. Is there a better syntax I could use to make this > work? "CAST (? AS INTERVAL)" should work. Or use org.postgresql.util.PGInterval: stmt.setObject(1, new PGInterval("14 days")); -O