Re: cast from integer to money

From: Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: cast from integer to money
Date: 2011-04-04 05:46:17
Message-ID: BANLkTinwYmXMWwL3VdnHudeJs9H7QUnfVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 3, 2011 at 11:23 PM, Robert Haas <robertmhaas(at)gmail(dot)com> 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?

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

Joey Adams

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Fowler 2011-04-04 07:51:01 Re: PG 9.0.3. How to select rows from xml
Previous Message Tom Lane 2011-04-04 03:33:56 Re: cast from integer to money