On Mon, Jun 20, 2011 at 5:54 AM, Vlad Arkhipov <arhipov@dc.baikal.ru> wrote:
> The behaviour of date_part function is opaque for infinity intervals. For
> example
> date_part('epoch', 'infinity'::date) and date_part('year', 'infinity'::date)
> return zero but is supposed to return 'infinity',
> date_part('day', 'infinity'::date) returns zero, should it return 'NaN'
> instead?
Dunno. It's been this way since 2001; before that, it returned NULL.
I don't see any particular justification for making the return value
different in the infinity case depending on whether "epoch" or "day"
is requested. Returning "Infinity" rather than 0 might have some
merit, but I'm not sure it's worth breaking backward compatibility for
it. What do our competitors do in this case?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company