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

From Tom Lane
Subject Re: 'infinity'::Interval should be added
Date
Msg-id 26567.1544904157@sss.pgh.pa.us
Whole thread Raw
In response to Re: 'infinity'::Interval should be added  (Andres Freund <andres@anarazel.de>)
Responses Re: 'infinity'::Interval should be added
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2018-12-15 14:43:49 -0500, Tom Lane wrote:
>> Note that timestamp_lt etc don't actually need any special case for
>> infinity, and we could hope that the infinity representation for interval
>> makes it possible to likewise not special-case it in interval comparisons.
>> But I think it's silly to argue that infinity handling is a significant
>> fraction of something like timestamp_pl_interval or timestamp_part.

> I'm inclined to agree that if done carefully the overhead here is
> probably acceptable.

Backing up to look at the actual code ... if the infinity representation
is the max or min value in each of the three fields, then the conversion
done by interval_cmp_value would yield an int128 value that's certainly
greater than or less than any other interval value, and I don't think it
can overflow, so there's no need to add any code to the comparison cases.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: 'infinity'::Interval should be added
Next
From: Alexander Korotkov
Date:
Subject: Re: Computing the conflict xid for index page-level-vacuum on primary