select to_number('1,000', '999,999');

From: David Schweikert <dws(at)ee(dot)ethz(dot)ch>
To: pgsql-bugs(at)postgresql(dot)org
Subject: select to_number('1,000', '999,999');
Date: 2004-11-19 12:20:34
Message-ID: 20041119122034.GA16198@ee.ethz.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : David Schweikert
Your email address : dws(at)ee(dot)ethz(dot)ch

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium 4

Operating System (example: Linux 2.4.18) : 2.4.25

PostgreSQL version (example: PostgreSQL-7.4.6): PostgreSQL-7.4.6

Compiler used (example: gcc 2.95.2) : gcc 3.3.3

Please enter a FULL description of your problem:
------------------------------------------------

select to_number('1,000', '999,999') returns '100'.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

Proposed addition to the regression tests:

--- src/test/regress/sql/numeric.sql.orig 2000-04-07 21:17:50.000000000 +0200
+++ src/test/regress/sql/numeric.sql 2004-11-19 12:51:57.071152000 +0100
@@ -701,3 +701,4 @@
SELECT '' AS to_number_11, to_number('.-01', 'S99.99');
SELECT '' AS to_number_12, to_number('.01-', '99.99S');
SELECT '' AS to_number_13, to_number(' . 0 1 -', ' 9 9 . 9 9 S');
+SELECT '' AS to_number_14, to_number(to_char('1000'::int, '999G999'),'999G999');

--- src/test/regress/expected/numeric.out.orig 2003-09-25 08:58:06.000000000 +0200
+++ src/test/regress/expected/numeric.out 2004-11-19 12:56:13.464401000 +0100
@@ -1112,3 +1112,9 @@
| -0.01
(1 row)

+SELECT '' AS to_number_14, to_number(to_char('1000'::int, '999G999'),'999G999');
+ to_number_14 | to_number
+--------------+-----------
+ | 1000
+(1 row)
+

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PostgreSQL Bugs List 2004-11-19 14:25:17 BUG #1326: Unique and Primary Key index over bigint type doesn't work
Previous Message Michael Fuhr 2004-11-19 04:55:50 Re: plperl crashes backend