Re: PreparedStatement error for date parameter with overlaps

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
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 05:27:48
Message-ID: 4DE47C54.3070706@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Simon Mitchell 2011-05-31 06:01:35 Re: PreparedStatement error for date parameter with overlaps
Previous Message Oliver Jowett 2011-05-31 03:32:02 Re: PreparedStatement error for date parameter with overlaps