Re: Have I found an interval arithmetic bug?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Have I found an interval arithmetic bug?
Дата
Msg-id 1119160.1627674882@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Have I found an interval arithmetic bug?  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: Have I found an interval arithmetic bug?
Список pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
> On Fri, Jul 30, 2021 at 03:08:56PM -0400, Robert Haas wrote:
>> Just to be clear, I am against this patch. I don't think it's a
>> minimal change for the reported problem, and I think some people will
>> be unhappy about the behavior changes.

> Uh, what do you suggest then?  You wanted the years/months fixed, and
> rounding at spill stop time makes sense, and fixes the problem.

The complained-of bug is that 'X years Y months' isn't always
identical to 'Y months X years'.  I do not believe that this patch
fixes that, though it may obscure the problem for some values of
X and Y.  After a quick look at the code, I am suspicious that
the actual problem is that AdjustFractDays is applied at the wrong
time, before we've collected all the input.  We probably need to
collect up all of the contributing input as floats and then do the
fractional spilling once at the end.

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.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Asynchronous and "direct" IO support for PostgreSQL.
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Have I found an interval arithmetic bug?