ibatis with overlaps query - Mailing list pgsql-sql

From Emi Lu
Subject ibatis with overlaps query
Date
Msg-id 49D4C551.3030702@encs.concordia.ca
Whole thread Raw
Responses Re: ibatis with overlaps query  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Good morning,

With ibatis, do overlap checking:

(1) select (DATE #begin_date#, DATE #end_date#) overlaps
(DATE '2008-01-01', DATE '2009-01-01')
. #begin_date# is varchar
. #end_date#   is varchar

Always get:
============
Cause: java.sql.SQLException: ERROR: syntax error at or near "$4"


However, when I updated the query to
(2) select (#begin_date#::DATE, #end_date#::DATE) overlaps
(DATE '2008-01-01', DATE '2009-01-01')

It works. I am bit confused why (1) does not work, but (2) does?

--
Lu Ying







pgsql-sql by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: SQL to Check whether "AN HOUR PERIOD" is between start and end timestamps
Next
From: Tony Cebzanov
Date:
Subject: Performance problem with row count trigger