Re: Have I found an interval arithmetic bug?
От | Bruce Momjian |
---|---|
Тема | Re: Have I found an interval arithmetic bug? |
Дата | |
Msg-id | 20210721024834.GA8395@momjian.us обсуждение исходный текст |
Ответ на | Re: Have I found an interval arithmetic bug? (Zhihong Yu <zyu@yugabyte.com>) |
Ответы |
Re: Have I found an interval arithmetic bug?
|
Список | pgsql-hackers |
On Tue, Jul 20, 2021 at 05:13:37PM -0700, Zhihong Yu wrote: > On Tue, Jul 20, 2021 at 3:53 PM Bruce Momjian <bruce@momjian.us> wrote: > With your patch, the following example (Coutesy Bryn) still shows fraction: > > # select (interval '1 month')*1.123; > ?column? > ----------------------- > 1 mon 3 days 16:33:36 > (1 row) > > Do you think the output can be improved (by getting rid of fraction) ? Well, I focused on how fractional units were processed inside of interval values. I never considered how multiplication should be handled. I have not really thought about how to handle that, but this example now gives me concern: SELECT INTERVAL '1.06 months 1 hour'; interval ----------------------- 1 mon 2 days 01:00:00 Notice that it rounds the '1.06 months' to '1 mon 2 days', rather than spilling to hours/minutes/seconds, even though hours is already specified. I don't see a better way to handle this than the current code already does, but it is something odd. -- 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 по дате отправления: