From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
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 01:47:58 |
Message-ID: | BANLkTin_rdrH=_MyQFddkNoCW1wC0bXmoQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Mon, May 30, 2011 at 8:39 AM, Simon Mitchell <simon(at)jseb(dot)com> wrote:
> jdbc driver issue for PreparedStatement error for date parameter with
> overlaps
> // some bad code
> sqlText = "SELECT (date ?, date ?) OVERLAPS (date ?, date ?);";
> System.out.println("Executing this command: "+sqlText+"\n");
> PreparedStatement prs = db.prepareStatement(sqlText);
> prs.setString(1,"2001-02-16");
> prs.setString(2,"2001-12-21");
> prs.setString(3,"2001-10-30");
> prs.setString(4,"2002-10-30");
> System.out.println("Executing this command: "+ prs.toString() +"\n");
> ResultSet results = prs.executeQuery();
> // error
> ***Exception:
> org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1"
> Position: 14
> Found a work around, changing the query to include brackets around the
> question marks works.
> sqlText = "SELECT (date (?), date (?)) OVERLAPS (date (?), date (?))";
> Is this a bug?
> --
> simon
>
Doesn't look like a bug. I don't think you can write that SQL in psql.
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-05-31 01:52:13 | Re: PreparedStatement error for date parameter with overlaps |
Previous Message | Simon Mitchell | 2011-05-30 21:30:28 | PreparedStatement error for date parameter with overlaps |