>
> If first period end and second period start dates are the same, I need that in this case expression
> returns true.
> Is it possible to implement this using OVERLAPS operator ?
>
I think the best workaround is a function of some kind in whichever
language you choose. I think you could actually clobber overlaps()
but I chose to give mine a different name. In my world, all date
ranges have a start, but can have an indefinite end (null).
CREATE OR REPLACE FUNCTION "isoverlap" (date,date,date,date) RETURNS
boolean LANGUAGE pltcl AS '
set d1 [clock scan $1]
set d3 [clock scan $3]
if {[string length $2] == 0} {
set d2 0
} else {
set d2 [clock scan $2]
}
if {[string length $4] == 0} {
set d4 0
} else {
set d4 [clock scan $4]
}
if {($d2 >= $d3 && ($d1 <= $d4 || !$d4)) ||
($d1 <= $d4 && ($d2 >= $d3 || !$d2)) ||
(!$d2 && !$d4)} {
return true
} else {
return false
}
' ;