Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 9B4E7B5F46F for ; Mon, 30 May 2011 22:52:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 46066-04 for ; Tue, 31 May 2011 01:52:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 498D6B5DDA0 for ; Mon, 30 May 2011 22:52:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p4V1qDel014647; Mon, 30 May 2011 21:52:13 -0400 (EDT) To: Simon Mitchell cc: pgsql-jdbc@postgresql.org Subject: Re: PreparedStatement error for date parameter with overlaps In-reply-to: References: Comments: In-reply-to Simon Mitchell message dated "Mon, 30 May 2011 22:39:38 +1000" Date: Mon, 30 May 2011 21:52:13 -0400 Message-ID: <14646.1306806733@sss.pgh.pa.us> From: Tom Lane 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/82 X-Sequence-Number: 21912 Simon Mitchell writes: > // some bad code > sqlText = "SELECT (date ?, date ?) OVERLAPS (date ?, date ?);"; That's not going to work, because the syntax date 'something' only works for literal constants, and a ? marker is not a literal constant. You could try ?::date or CAST(? AS date) if you prefer to avoid Postgres-specific syntax. Even better, don't use setString --- that's really only meant for parameters that are of string datatypes. regards, tom lane