Re: PreparedStatement error for date parameter with overlaps

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Mitchell <simon(at)jseb(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PreparedStatement error for date parameter with overlaps
Date: 2011-05-31 14:10:22
Message-ID: 26246.1306851022@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Simon Mitchell <simon(at)jseb(dot)com> 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Emi Lu 2011-05-31 17:07:19 "postgresql-9.0-801.jdbc4.jar" Causing "Error committing transaction. Cause: org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled." Exception
Previous Message Craig Ringer 2011-05-31 06:41:36 Re: PreparedStatement error for date parameter with overlaps