Re: 'infinity'::Interval should be added

From: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, simon(at)2ndquadrant(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 'infinity'::Interval should be added
Date: 2018-12-17 04:27:34
Message-ID: CAMsGm5f_3_w68hiiohDqhwrWvbY-6KRd5gYnNFCZgTkDEaW8dg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 16 Dec 2018 at 22:27, Robert Haas <robertmhaas(at)gmail(dot)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:

https://www.postgresql.org/docs/8.4/datatype-datetime.html

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).

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-12-17 05:14:39 Re: ALTER INDEX ... ALTER COLUMN not present in dump
Previous Message Tom Lane 2018-12-17 03:48:53 Re: 'infinity'::Interval should be added