The following bug has been logged online:
Bug reference: 4085
Logged by: Jeff Dwyer
Email address: jdwyer@patientslikeme.com
PostgreSQL version: 8.3.1
Operating system: Mac OS X
Description: No implicit cast after coalesce
Details:
This works fine:
select 1 where current_date between '1900-3-3' and '1900-2-2';
This doesn't:
select 1 where current_date between coalesce(null,current_date) and
coalesce(null, '1900-1-2');
This fix works:
select 1 where current_date between coalesce(null,current_date) and
coalesce(null, date('1900-1-2'));
This seems like a bug to me. Why should an explicit cast be necessary after
a coalesce? This broke code that worked in 8.1.
Thanks,
-Jeff