Robert Haas <robertmh...@gmail.com> writes: > Simon's argument for adding this is that we support 'infinity' for > timestamp, but is that a good argument for making 'interval' do it, > given that there are many other types like date for which we don't > support it?
My feeling is that date is to timestamp as integer is to float. We have infinities in the latter types but not the former, and that seems just fine: infinity is one of the additional values that you get to have with the bigger/more expensive type. So I don't really feel that the lack of infinity in date is an argument against whether to provide it for interval. The positive argument for adding infinity to interval is that we define operations such as timestamp minus timestamp as yielding interval. That's why this has to fail right now: regression=# select timestamp 'infinity' - timestamp 'now'; ERROR: cannot subtract infinite timestamps But if we had infinite intervals then that would have a well defined result, just as this works: regression=# select extract(epoch from timestamp 'infinity'); date_part ----------- Infinity (1 row) Of course, there are still cases like timestamp 'infinity' - timestamp 'infinity' that would need to fail, but that has a semantic basis rather than "the output type can't represent it". (No, I don't want to invent an interval equivalent of NaN to make that not fail.) [ wanders away wondering why type numeric has NaN but not infinity ] regards, tom lane