Re: money type overflow checks

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: money type overflow checks
Date: 2016-08-11 20:09:53
Message-ID: 1a499c6f-9a35-9eca-9857-0acbe371e74a@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 that way
> mainly to avoid hard-wired assumptions about how wide int64 is, a
> consideration that's a mite obsolete now.

OK, I did it like int8, and added more tests. My original patch didn't
get the most negative integer right.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v2-0001-Add-overflow-checks-to-money-type-input-function.patch text/x-patch 7.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2016-08-11 21:11:03 Add hint for function named "is"
Previous Message Tom Lane 2016-08-11 19:34:16 Re: No longer possible to query catalogs for index capabilities?