Re: pgsql: Fix NUMERIC modulus to properly truncate

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgsql: Fix NUMERIC modulus to properly truncate
Дата
Msg-id 911.1117947103@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Fix NUMERIC modulus to properly truncate  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Список pgsql-committers
Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
>> No, I don't think so.  It doesn't seem to be something that enough
>> people use to risk the change in behavior --- it might break something
>> that was working.  But, if folks want it backported we can do it.  It is
>> only a change to properly do modulus for numeric.

> Well, from my point of view it's an absolute mathematical error - i'd
> backport it.  I can't see anyone relying on it :)

Doesn't this patch break the basic theorem that

    a = trunc(a / b) * b + (a mod b)

?  If division rounds and mod doesn't, you've got pretty serious issues.

            regards, tom lane

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

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: pgsql: Fix NUMERIC modulus to properly truncate
Следующее
От: tgl@svr1.postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Remove planner's private fields from Query struct, and put them