Re: 'infinity' in GiST index - Mailing list pgsql-hackers

From Tom Lane
Subject Re: 'infinity' in GiST index
Date
Msg-id 18960.1115266606@sss.pgh.pa.us
Whole thread Raw
In response to 'infinity' in GiST index  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-hackers
Oleg Bartunov <oleg@sai.msu.su> writes:
> there was complain about problem with creating GiST index if
> timestamp column contains 'infinity' value. The problem is indeed
> exists and I'd like to have it fixed, but we have no idea 
> how to handle it in GiST, actually in penalty function.
> Any thoughts ?

Seems like it's not really GiST's fault but a definitional problem
for the timestamp datatype.  Specifically, what does it mean to
subtract two infinite timestamps?  I find it hard to assign a
value to any of these combinations:+infinity minus +infinity-infinity minus -infinity+infinity minus -infinity-infinity
minus+infinity
 
The first two can't really be identified with zero, and the last two are
surely not representable are they?

What's worse, a subtraction involving one infinite and one finite
timestamp *is* well defined from a mathematical point of view, eg+infinity minus 'yesterday' = +infinity
but I doubt GiST will be happy if we make the datatype behave that
way...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: 'infinity' in GiST index
Next
From: Josh Berkus
Date:
Subject: Views, views, views! (long)