Re: 'infinity'::Interval should be added - Mailing list pgsql-hackers

From Isaac Morland
Subject Re: 'infinity'::Interval should be added
Date
Msg-id CAMsGm5f_3_w68hiiohDqhwrWvbY-6KRd5gYnNFCZgTkDEaW8dg@mail.gmail.com
Whole thread Raw
In response to Re: 'infinity'::Interval should be added  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Sun, 16 Dec 2018 at 22:27, Robert Haas <robertmhaas@gmail.com> wrote:
 
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?

postgres=> select 'infinity'::date, '-infinity'::date;
   date   |   date    
----------+-----------
 infinity | -infinity
(1 row)

postgres=> 

Works since 8.4:


I think that in principle an argument can be made for having infinity and -infinity in every data type, sort of like how every data type has null, but based on the nature of the system as it exists I'm not going to advance that argument.

I do think that decimal/numeric probably ought to have infinity, assuming there is a reasonable way to fit them into the representation, but integer types are currently exactly 2/4/8-byte 2's complement values so I don't see how to squeeze in infinite values in a way that wouldn't mess up existing code (or cause handling of integer values to be much slower).

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 'infinity'::Interval should be added
Next
From: Michael Paquier
Date:
Subject: Re: ALTER INDEX ... ALTER COLUMN not present in dump