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

2011-07-13 Thread Bruce Momjian
Daniele Varrazzo wrote: Hello, =# select extract(epoch from 'infinity'::timestamp); date_part --- 0 A better value would be 'infinity'::float8. Ditto for -infinity. I'm trying to use a box-based index to represent the intervals in a table containing a pair of fields

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

2011-07-13 Thread Robert Haas
On Jul 13, 2011, at 1:43 PM, Bruce Momjian br...@momjian.us wrote: Daniele Varrazzo wrote: Hello, =# select extract(epoch from 'infinity'::timestamp); date_part --- 0 A better value would be 'infinity'::float8. Ditto for -infinity. I'm trying to use a box-based index

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

2011-07-13 Thread Alvaro Herrera
Excerpts from Robert Haas's message of mié jul 13 16:13:12 -0400 2011: On Jul 13, 2011, at 1:43 PM, Bruce Momjian br...@momjian.us wrote: Daniele Varrazzo wrote: =# select extract(epoch from 'infinity'::timestamp); date_part --- 0 A better value would be

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

2011-07-13 Thread Brendan Jurd
On 14 July 2011 06:58, Alvaro Herrera alvhe...@commandprompt.com wrote: I don't find the proposed behavior all that suprising, which the original behavior surely is.  I guess the bigger question is whether the values that timestamptz_part() returns for other cases (than epoch) should also be

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

2011-07-13 Thread Josh Berkus
It's sort of non-obvious that either behavior is better than the other. Here's the reason why the existing behavior is wrong: postgres=# select extract('epoch' from timestamptz 'infinity') = extract ('epoch' from timestamptz '1970-01-01 00:00:00-00'); ?column? -- t -- Josh Berkus

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

2011-07-13 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Jul 13, 2011, at 1:43 PM, Bruce Momjian br...@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

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

2011-07-13 Thread Robert Haas
On Jul 13, 2011, at 4:21 PM, Brendan Jurd dire...@gmail.com wrote: On 14 July 2011 06:58, Alvaro Herrera alvhe...@commandprompt.com wrote: I don't find the proposed behavior all that suprising, which the original behavior surely is. I guess the bigger question is whether the values that

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

2011-07-13 Thread Brendan Jurd
On 14 July 2011 08:16, Robert Haas robertmh...@gmail.com wrote: On Jul 13, 2011, at 4:21 PM, Brendan Jurd dire...@gmail.com wrote: Well, for example, how do you go about answering the question what is the day-of-month of the infinite timestamp?  The question is nonsense; it doesn't have a