Re: Have I found an interval arithmetic bug?
| От | Bruce Momjian |
|---|---|
| Тема | Re: Have I found an interval arithmetic bug? |
| Дата | |
| Msg-id | 20210403021905.GF29126@momjian.us обсуждение исходный текст |
| Ответ на | Re: Have I found an interval arithmetic bug? (Zhihong Yu <zyu@yugabyte.com>) |
| Список | pgsql-hackers |
On Fri, Apr 2, 2021 at 06:11:08PM -0700, Zhihong Yu wrote:
> Hi,
> I got a local build with second patch where:
>
> yugabyte=# SELECT interval '0.3 years' + interval '0.4 years' -
> interval '0.7 years';
> ?column?
> ----------
> 1 mon
>
> I think the outcome is a bit unintuitive (I would expect result close to 0).
Uh, the current code returns:
SELECT interval '0.3 years' + interval '0.4 years' - interval '0.7 years';
?column?
----------
-1 mon
and with the patch it is:
SELECT interval '0.3 years' + interval '0.4 years' - interval '0.7 years';
?column?
----------
1 mon
What it isn't, is zero months, which is the obviously ideal answer.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
If only the physical world exists, free will is an illusion.
В списке pgsql-hackers по дате отправления: