Re: bug in the money type - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: bug in the money type
Date
Msg-id 200107232128.f6NLSmZ21454@candle.pha.pa.us
Whole thread Raw
In response to bug in the money type  (Geoff Reedy <vader21@imsa.edu>)
List pgsql-bugs
Use DECIMAL type.  We will remove MONEY in a upcoming release.

> ============================================================================
>                         POSTGRESQL BUG REPORT TEMPLATE
> ============================================================================
>
>
> Your name        :    Geoffrey Reedy
> Your email address    :    vader21@imsa.edu
>
>
> System Configuration
> ---------------------
>   Architecture (example: Intel Pentium)      :   Intel Pentium III
>
>   Operating System (example: Linux 2.0.26 ELF)     :   Linux 2.2.14 ELF SMP
>
>   PostgreSQL version (example: PostgreSQL-7.1.1):   PostgreSQL-7.1.2
>
>   Compiler used (example:  gcc 2.95.2)        :   unknown (binary RPM)
>
>
> Please enter a FULL description of your problem:
> ------------------------------------------------
>
> The money type fails at the roll-over value of 21474836.48 (2^31). On either
> side of 21474836.48 (2^31) the money evaluates to the expected result
> (+- 21474836.47).  Calling some functions with this problematic monetary
> value causes the backend to exit unexpectedly.
>
> Please describe a way to repeat the problem.   Please try to provide a
> concise reproducible example, if at all possible:
> ----------------------------------------------------------------------
>
> vader21=> select (money '21474836.47');
>     ?column?
> ----------------
>  $21,474,836.47
> (1 row)
>
> vader21=> select (money '21474836.49');
>     ?column?
> -----------------
>  -$21,474,836.47
> (1 row)
>
> vader21=> select (money '21474836.48');
>     ?column?
> -----------------
>  -$./,,),,(-*.,(
> (1 row)
>
> vader21=> select cash_words(money '21474836.48');
> pqReadData() -- backend closed the channel unexpectedly.
>     This probably means the backend terminated abnormally
>     before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.
>
> If you know how this problem might be fixed, list the solution below:
> ---------------------------------------------------------------------
>
> Probably just a bounds check in src/backend/utils/adt/cash.c needs to be
> added.  I could probably whip up a patch, but don't have time to do that
> right now.  Perhaps in the next few days I will be able to do that.
>
> --
> Geoffrey Reedy                                       vader21@imsa.edu
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-bugs by date:

Previous
From: Felipe Alvarez Harnecker
Date:
Subject: Re: date style bug
Next
From: Felipe Alvarez Harnecker
Date:
Subject: Re: Documentation Bug related to Inheritance