pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Simon Mitchell <simon@jseb.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: PreparedStatement error for date parameter with overlaps
Date: Tue, 31 May 2011 13:27:48 +0800
Message-ID: <4DE47C54.3070706@postnewspapers.com.au> (raw)
In-Reply-To: <BANLkTim756hJon=1wyLeCuyH4bth3fcNiQ@mail.gmail.com>
References: <BANLkTikCY4ax50aOqNy2BdoYEoLSdc1Sew@mail.gmail.com>
	<14646.1306806733@sss.pgh.pa.us>
	<BANLkTim756hJon=1wyLeCuyH4bth3fcNiQ@mail.gmail.com>

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



view thread (11+ messages)  latest in thread

Message-ID: <4DE47C54.3070706@postnewspapers.com.au>
Permalink:  ../4DE47C54.3070706@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4DE47C54.3070706@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: craig@postnewspapers.com.au, simon@jseb.com
  Subject: Re: PreparedStatement error for date parameter with overlaps
  In-Reply-To: <4DE47C54.3070706@postnewspapers.com.au>
  References: <BANLkTikCY4ax50aOqNy2BdoYEoLSdc1Sew@mail.gmail.com> <14646.1306806733@sss.pgh.pa.us> <BANLkTim756hJon=1wyLeCuyH4bth3fcNiQ@mail.gmail.com> <4DE47C54.3070706@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox