Re: [BUGS] extract(epoch from infinity) is not 0

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] extract(epoch from infinity) is not 0
Date: 2011-07-13 21:22:36
Message-ID: 10833.1310592156@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Jul 13, 2011, at 1:43 PM, Bruce Momjian <bruce(at)momjian(dot)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 behavior with 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2011-07-13 22:16:56 Re: [BUGS] extract(epoch from infinity) is not 0
Previous Message Josh Berkus 2011-07-13 21:22:26 Re: [BUGS] extract(epoch from infinity) is not 0

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2011-07-13 21:56:13 Reduced power consumption in WAL Writer process
Previous Message Josh Berkus 2011-07-13 21:22:26 Re: [BUGS] extract(epoch from infinity) is not 0