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.