Re: [BUGS] extract(epoch from infinity) is not 0 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUGS] extract(epoch from infinity) is not 0
Date
Msg-id 10833.1310592156@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUGS] extract(epoch from infinity) is not 0  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Jul 13, 2011, at 1:43 PM, Bruce Momjian <bruce@momjian.us> wrote:
>> I see:
>> 
>> if (TIMESTAMP_NOT_FINITE(timestamp))
>> {
>>     result = 0;
>>     PG_RETURN_FLOAT8(result);
>> }
>> 
>> Does anyone object to changing this?

> It's sort of non-obvious that either behavior is better than the other. We might just be replacing one surprising
behaviorwith another.
 

Well, this code path is not much except a punt.  If we're going to touch
it we should think through the behavior for all field types, not just
epoch.

I think a reasonable case could be made for throwing error or returning
NaN (indicating "indeterminate") for most field types.  I can see
returning +/- infinity for epoch --- are there any others where that's
sane?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: [BUGS] extract(epoch from infinity) is not 0
Next
From: Peter Geoghegan
Date:
Subject: Reduced power consumption in WAL Writer process