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 7CC33DAEEA for ; Thu, 27 Oct 2005 21:03:31 -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 01707-01 for ; Fri, 28 Oct 2005 00:03:28 +0000 (GMT) Received: from mail5.dslextreme.com (mail5.dslextreme.com [66.51.199.81]) by svr1.postgresql.org (Postfix) with SMTP id 06A56D769C for ; Thu, 27 Oct 2005 21:03:29 -0300 (ADT) Received: (qmail 31958 invoked from network); 28 Oct 2005 00:03:15 -0000 Received: from unknown (HELO x1000.msqr.us) (66.245.216.57) by mail5.dslextreme.com with (EDH-RSA-DES-CBC3-SHA encrypted) SMTP; Thu, 27 Oct 2005 17:03:15 -0700 Received: from x1000.msqr.us (x1000.msqr.us [127.0.0.1]) by x1000.msqr.us (8.13.1/8.13.1) with ESMTP id j9S02EgD028722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 27 Oct 2005 17:02:19 -0700 Received: (from apache@localhost) by x1000.msqr.us (8.13.1/8.13.1/Submit) id j9S02EHI028721; Thu, 27 Oct 2005 17:02:14 -0700 Received: from 219.89.94.58 (SquirrelMail authenticated user matt); by msqr.us with HTTP; Thu, 27 Oct 2005 17:02:14 -0700 (PDT) Message-ID: <50418.219.89.94.58.1130457734.squirrel@msqr.us> In-Reply-To: <50387.219.89.94.58.1130457365.squirrel@msqr.us> References: <50387.219.89.94.58.1130457365.squirrel@msqr.us> Date: Thu, 27 Oct 2005 17:02:14 -0700 (PDT) Subject: Re: INTERVAL parameter in PreparedStatement worked in 7.4 From: "Matt Magoffin" To: pgsql-jdbc@postgresql.org User-Agent: SquirrelMail/1.4.3a-12.EL4 X-Mailer: SquirrelMail/1.4.3a-12.EL4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200510/139 X-Sequence-Number: 14070 I forgot to add that the 8 driver throws an exception when trying to parse the statement with the positional parameter: java.sql.SQLException: ERROR: syntax error at or near "$1" -- m@ > Hello, > > 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? > > The query does work in the 8 driver if the ? is explicitly part of the > query, i.e. not a positional parameter, like this: > > select * from users users where users.createdDate < (CURRENT_DATE - > INTERVAL '14 DAYS') > > Any help much appreciated, > m@