Re: bug in the money type

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Geoff Reedy <vader21(at)imsa(dot)edu>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: bug in the money type
Date: 2001-07-23 21:28:48
Message-ID: 200107232128.f6NLSmZ21454@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)imsa(dot)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(at)imsa(dot)edu
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Felipe Alvarez Harnecker 2001-07-23 22:00:43 Re: Documentation Bug related to Inheritance
Previous Message Darko Prenosil 2001-07-23 17:47:14 Re: [BUGS] WIN32 MULTIBYTE