Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 175A6B5F520 for ; Tue, 31 May 2011 02:27:58 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 34205-08 for ; Tue, 31 May 2011 05:27:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id 56737B5F518 for ; Tue, 31 May 2011 02:27:51 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id B1D9210D; Tue, 31 May 2011 01:27:50 -0400 (EDT) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IurVLjlf6RCZ; Tue, 31 May 2011 01:27:50 -0400 (EDT) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id 0449D2D; Tue, 31 May 2011 01:27:50 -0400 (EDT) Received: from [10.0.0.53] (wallace.localnet [10.0.0.53]) by mail.postnewspapers.com.au (Postfix) with ESMTP id ED938AF2A4; Tue, 31 May 2011 13:27:48 +0800 (WST) Message-ID: <4DE47C54.3070706@postnewspapers.com.au> Date: Tue, 31 May 2011 13:27:48 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110307 Thunderbird/3.1.9 MIME-Version: 1.0 To: Simon Mitchell CC: pgsql-jdbc@postgresql.org Subject: Re: PreparedStatement error for date parameter with overlaps References: <14646.1306806733@sss.pgh.pa.us> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/85 X-Sequence-Number: 21915 On 31/05/11 11:12, Simon Mitchell wrote: > Both ?::date and CAST(? AS date) fail in java. > > ?::date works fine in psql, but CAST(? AS date) fails in psql. > > SELECT (date CAST('2001-02-16' AS date), date ('2001-12-21')) OVERLAPS > (date ('2001-10-30'), date ('2002-10-30')); > ERROR: syntax error at or near "CAST" You wrote: SELECT (date CAST('2001-02-16' AS date) ... ^^^^ whoops you should write: SELECT (CAST('2001-02-16' AS date) ... See how that goes. -- Craig Ringer