Re: [GENERAL] Unexpected interval comparison

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] Unexpected interval comparison
Дата
Msg-id 30765.1490107336@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [GENERAL] Unexpected interval comparison  (Frazer McLean <frazer@frazermclean.co.uk>)
Ответы Re: [GENERAL] Unexpected interval comparison
Список pgsql-general
Frazer McLean <frazer@frazermclean.co.uk> writes:
> I came across an unexpected comparison (tested on PostgreSQL 9.4 and
> 9.6) for intervals with a large difference in magnitude.

>   '1 year'::interval > '32618665 years'::interval;

> Is this a bug?

It looks like the problem is overflow of the result of interval_cmp_value,
because it's trying to compute

=# select '32618665'::int8 * 30 * 86400 * 1000000;
ERROR:  bigint out of range

It's not immediately obvious how to avoid that while preserving the same
comparison semantics :-(

            regards, tom lane


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

Предыдущее
От: Frazer McLean
Дата:
Сообщение: [GENERAL] Unexpected interval comparison
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: [GENERAL] Unexpected interval comparison