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

Re: 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: Re: select to_number('1,000', '999,999');
Date: 2004-11-22 06:50:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
On Sun, Nov 21, 2004 at 20:10:08 -0500, Tom Lane wrote:
> I'm not entirely convinced this is a bug.  I get the right answer from
> regression=# select to_number('001,000', '999,999') ;
>  to_number 
> -----------
>       1000
> (1 row)
> It's arguable that to_number() should throw an error when the input
> doesn't match the format, but right now it doesn't ...

It seems strange to me that to_char(1000,'999,999') works (it returns
1,000), but the reverse doesn't.

I want to convert a formatted number with group separators, but I don't
know how many digits it has: should I count the digits myself and adapt
the mask (which is a customization and thus entered by the user)?


David Schweikert        | phone: +41 44 632 7019
System manager ISG.EE   | walk:  ETH Zentrum, ETL F24.1
ETH Zurich, Switzerland | web:

In response to


pgsql-bugs by date

Next:From: John HansenDate: 2004-11-22 09:15:17
Subject: Psql history
Previous:From: Nicola PeroDate: 2004-11-22 04:34:22
Subject: Data corruption/loss when altering tables

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