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

2011-07-13 Thread Brendan Jurd
On 14 July 2011 08:16, Robert Haas wrote: > On Jul 13, 2011, at 4:21 PM, Brendan Jurd 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 defined day of month, so I think w

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 wrote: > On 14 July 2011 06:58, Alvaro Herrera 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

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

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

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 P

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

2011-07-13 Thread Brendan Jurd
On 14 July 2011 06:58, Alvaro Herrera 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 different from 0 when an

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 wrote: > > Daniele Varrazzo wrote: > >> =# select extract(epoch from 'infinity'::timestamp); > >> date_part > >> --- > >> 0 > >> > >> A better value would be 'infin

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 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 in

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