Re: [HACKERS] money type overflow checks

2016-08-11 Thread Peter Eisentraut
On 8/5/16 1:14 PM, Tom Lane wrote: > No, I don't think it's sufficient after a multiplication by 10. That > would be enough to shift some bits clear out of the word, but there's > no certainty that the new sign bit would be 1. > > The scheme used in scanint8 is safe. But I think it was written t

Re: [HACKERS] money type overflow checks

2016-08-05 Thread Tom Lane
Peter Eisentraut writes: > The input function of the money type has no overflow checks: Ugh. > (Is checking for < 0 a valid overflow check? No, I don't think it's sufficient after a multiplication by 10. That would be enough to shift some bits clear out of the word, but there's no certainty th

[HACKERS] money type overflow checks

2016-08-05 Thread Peter Eisentraut
The input function of the money type has no overflow checks: => select '12345678901234567890'::money; money - -$13,639,628,150,831,692.72 (1 row) The tests in the regression test file money.sql are bogus because they only test the overflow checks of the bi