Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id D14A7B5DF70 for ; Tue, 31 May 2011 11:10:32 -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 69415-05 for ; Tue, 31 May 2011 14:10:25 +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 CD14EB5DD79 for ; Tue, 31 May 2011 11:10:24 -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 p4VEAMMe026247; Tue, 31 May 2011 10:10:23 -0400 (EDT) To: Simon Mitchell cc: pgsql-jdbc@postgresql.org Subject: Re: PreparedStatement error for date parameter with overlaps In-reply-to: References: <14646.1306806733@sss.pgh.pa.us> <4DE47C54.3070706@postnewspapers.com.au> Comments: In-reply-to Simon Mitchell message dated "Tue, 31 May 2011 16:01:35 +1000" Date: Tue, 31 May 2011 10:10:22 -0400 Message-ID: <26246.1306851022@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/88 X-Sequence-Number: 21918 Simon Mitchell writes: > So from what I understand using the date function in jdbc stuff requires > brackets like most functions do, > but the psql is happy for me to use the date function with or without > brackets. Craig Ringer already posted a much more long-winded response, but the short answer is that this syntax is *not* a function. The SQL spec defines type_name 'literal string' as a way of writing a literal constant of a specific type. (The spec actually only seems to allow this for certain type names, but Postgres extends that to allow any known type name to be used.) This is not a function and it doesn't work for any case except where the second part is a quoted literal string. Personally I think it's a wart best avoided, but we're stuck with supporting it because of the standard. regards, tom lane