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

From Simon Mitchell
Subject PreparedStatement error for date parameter with overlaps
Date
Msg-id BANLkTimOyZfaWQw9++4+oSZ=Of=pfkSQ9Q@mail.gmail.com
Whole thread Raw
List pgsql-jdbc
    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

pgsql-jdbc by date:

Previous
From: "David Johnston"
Date:
Subject: Inconsistent "Set Local search_path" behavior in JDBC
Next
From: Simon Mitchell
Date:
Subject: PreparedStatement error for date parameter with overlaps