Re: date_part for infinity intervals

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Vlad Arkhipov <arhipov(at)dc(dot)baikal(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: date_part for infinity intervals
Date: 2011-06-22 02:06:57
Message-ID: BANLkTik71qWhTDOLbPEKEL7At755znfo4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 20, 2011 at 5:54 AM, Vlad Arkhipov <arhipov(at)dc(dot)baikal(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-06-22 02:09:48 Re: Auto Start second postgres 8.3.15-1 instance MAC OS X
Previous Message Robert Haas 2011-06-22 01:54:49 Re: SSI tuning points