Skip site navigation (1) Skip section navigation (2)

bug in the money type

From: Geoff Reedy <vader21(at)imsa(dot)edu>
To: pgsql-bugs(at)postgresql(dot)org
Cc: vader21(at)imsa(dot)edu
Subject: bug in the money type
Date: 2001-07-17 21:45:53
Message-ID: 20010717164553.A17380@imsa.edu (view raw or flat)
Thread:
Lists: pgsql-bugs
============================================================================
                        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

Responses

pgsql-bugs by date

Next:From: pgsql-bugsDate: 2001-07-17 22:14:42
Subject: some timestamps are wrong from JDBC
Previous:From: Felipe Alvarez HarneckerDate: 2001-07-17 16:24:03
Subject: date style bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group