>> In my application second and fourth parameters can be NULL which means
>> forever.
>
> No it doesn't. NULL means "unknown". You're just using it to represent
> "forever".
My table represents employee absence starting and ending dates.
If end day is not yet known, it is represented by NULL value.
My query should threat unknown value as never ending absence to return
estimated number of work days.
Infinity date value is missing in SQL standard.
I do'nt know any other good way to represent missing ending date.
> There is a value "infinity" for timestamps, but unfortunately not for
> dates. Otherwise, I'd suggest that you use that instead.
I tried to use
timestamp 'infinity':: date
but this does not work if both b and d are infinity since
select timestamp 'infinity':: date<=timestamp 'infinity':: date
returns null.
Andrus.