Re: PreparedStatement error for date parameter with overlaps - Mailing list pgsql-jdbc

From Craig Ringer
Subject Re: PreparedStatement error for date parameter with overlaps
Date
Msg-id 4DE47C54.3070706@postnewspapers.com.au
Whole thread Raw
In response to Re: PreparedStatement error for date parameter with overlaps  (Simon Mitchell <simon@jseb.com>)
Responses Re: PreparedStatement error for date parameter with overlaps
List 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

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: PreparedStatement error for date parameter with overlaps
Next
From: Simon Mitchell
Date:
Subject: Re: PreparedStatement error for date parameter with overlaps