From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bryn Llewellyn <bryn(at)yugabyte(dot)com> |
Cc: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Zhihong Yu <zyu(at)yugabyte(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, John W Higgins <wishdev(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Have I found an interval arithmetic bug? |
Date: | 2021-07-21 17:29:49 |
Message-ID: | 711398.1626888589@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Bryn Llewellyn <bryn(at)yugabyte(dot)com> writes:
> On 21-Jul-2021, at 02:58, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> In general, considering that (most of?) the existing behavior has stood
>> for decades, I think we need to tread VERY carefully about changing it.
>> I don't want to see this patch changing any case that is not indisputably
>> broken.
> It was me that started the enormous thread with the title “Have I found an interval arithmetic bug?” on 01-Apr-2021. I presented this testcase:
>> select interval '-1.7 years'; -- -1 years -8 mons
>>
>> select interval '29.4 months'; -- 2 years 5 mons 12 days
>>
>> select interval '-1.7 years 29.4 months'; -- 8 mons 12 days << wrong
>> select interval '29.4 months -1.7 years'; -- 9 mons 12 days
>>
>> select interval '-1.7 years' + interval '29.4 months'; -- 9 mons 12 days
>> select interval '29.4 months' + interval '-1.7 years'; -- 9 mons 12 days
> The consensus was that the outcome that I flagged with “wrong” does indeed have that status.
Yeah, I think it's self-evident that your last four cases should
produce the same results. Whether '9 mons 12 days' is the best
possible result is debatable --- in a perfect world, maybe we'd
produce '9 mons' exactly --- but given that the first two cases
produce what they do, that does seem self-consistent. I think
we should be setting out to fix that outlier without causing
any of the other five results to change.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bryn Llewellyn | 2021-07-21 17:44:08 | Re: Have I found an interval arithmetic bug? |
Previous Message | Nicolas Seinlet | 2021-07-21 17:25:43 | Re: More records after sort |
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2021-07-21 17:34:00 | Re: Added schema level support for publication. |
Previous Message | vignesh C | 2021-07-21 17:29:44 | Re: Added schema level support for publication. |