Re: pgsql: Fix NUMERIC modulus to properly truncate - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Fix NUMERIC modulus to properly truncate
Date
Msg-id 911.1117947103@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Fix NUMERIC modulus to properly truncate  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
List 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 by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: pgsql: Fix NUMERIC modulus to properly truncate
Next
From: tgl@svr1.postgresql.org (Tom Lane)
Date:
Subject: pgsql: Remove planner's private fields from Query struct, and put them