| From: | Bruce Momjian <bruce(at)momjian(dot)us> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, John W Higgins <wishdev(at)gmail(dot)com>, pgsql-hackers list <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Have I found an interval arithmetic bug? |
| Date: | 2021-07-30 19:56:49 |
| Message-ID: | 20210730195649.GF9600@momjian.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-hackers |
On Fri, Jul 30, 2021 at 03:54:42PM -0400, Tom Lane wrote:
> Having said that, I also agree that it's not great that '1.4 years'
> is converted to '1 year 4 mons' (1.33333... years) rather than
> '1 year 5 mons' (1.41666... years). The latter seems like a clearly
> saner translation. I would really rather that we reject such input
> altogether, but if we're going to accept it, we should round not
> truncate.
My patch returns what you want:
SELECT interval '1.4 years';
interval
---------------
1 year 5 mons
--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com
If only the physical world exists, free will is an illusion.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2021-07-30 20:44:06 | Re: Have I found an interval arithmetic bug? |
| Previous Message | Bruce Momjian | 2021-07-30 19:55:05 | Re: Have I found an interval arithmetic bug? |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2021-07-30 20:00:44 | Re: Background writer and checkpointer in crash recovery |
| Previous Message | Bruce Momjian | 2021-07-30 19:55:05 | Re: Have I found an interval arithmetic bug? |