On Apr 4, 2011, at 1:46 AM, Joseph Adams <[email protected]> wrote:
> On Sun, Apr 3, 2011 at 11:23 PM, Robert Haas <[email protected]> wrote:
>> Thanks for the patch, but I think you forgot to worry about overflow:
>> 
>> rhaas=# select 9223372036854775807::money;
>>  money
>> --------
>>  -$1.00
>> (1 row)
> 
> cash_in doesn't test for overflow, either (tested on 8.4.0, 9.0.3, and HEAD):
> 
> joey=# select '9223372036854775807'::money;
> money
> --------
> -$1.00
> (1 row)
> 
> Is this a bug?

Seems like it. You have to feel sorry for the guy who deposits 9 quintillion 
dollars and then gets a note from the bank saying his account is overdrawn...

> Detail: unlike cash_in, numeric_cash does check for overflow
> (implicitly, through its use of numeric_int8).

Yeah.

...Robert
-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to