Re: 'infinity'::Interval should be added

Поиск
Список
Период
Сортировка
От Isaac Morland
Тема Re: 'infinity'::Interval should be added
Дата
Msg-id CAMsGm5fN0T541Ck6Q7wED5oHLDSjdb10AMMwLzxJEY7+O7fDHw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: 'infinity'::Interval should be added  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: 'infinity'::Interval should be added  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Mon, 17 Dec 2018 at 18:00, Tom Lane <tgl@sss.pgh.pa.us> wrote:
 
> so I was thinking that
> postgres=# select 'infinity'::timestamp - 'infinity'::timestamp;
> would be zero rather than an error, for least surprise.

Wrong.  This case needs to be undefined, because "infinity"
isn't a specific value.  That's what makes it okay to define, say,
infinity plus any finite value as infinity.  There are very
well-defined rules about how to calculate with infinity, and
not following them is not the way to proceed here.

tl;dr: we should model it after the behavior of IEEE float infinities,
except we'll want to throw errors where those produce NaNs.

Would it be OK to return NULL for ∞ - ∞? Then anybody who wanted 0 could get it with coalesce (although I think this is a worse idea than anybody who wants it probably realizes), and anybody who wanted the calculation to continue on would just get a NULL propagating.

Also am I right to assume that -infinity would use -INT_MAX, etc.? Or possibly -INT_MAX - 1? 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Should new partitions inherit their tablespace from their parent?
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Fixing typos in tests of partition_info.sql