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

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, David Schweikert <dws(at)ee(dot)ethz(dot)ch>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: select to_number('1,000', '999,999');
Date: 2004-11-23 08:39:21
Message-ID: 1101199163.6377.55.camel@fixzilla
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, 2004-11-22 at 11:08 -0500, Tom Lane wrote:
> Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> > No, but I think you're supposed to use FM in such cases.
> >
> > select to_number(1000, 'FM999,999');
>
> Good point --- I had forgot about FM. In that case there *is* a bug
> here, but I'm not sure if it's with to_char or to_number:
>
> regression=# select to_number(to_char(1000, 'FM999,999'),'FM999,999');
> to_number
> -----------
> 1000
> (1 row)
>
> regression=# select to_number(to_char(1000, '999,999'),'999,999');
> to_number
> -----------
> 100
> (1 row)

It's to_number() bug. I'm not sure if now (before release) is good time
to fix it. The code of to_number() is not stable for changes and maybe
we can fix this bug add some other new...

I already work on new version for next release. It will use
unit-tests -- I hope it will prevent a lot of bugs like this.

> Whatever your opinion is about the behavior of the non-FM format, surely
> to_char and to_number should be inverses.

Yes.

Karel

--
Karel Zak
http://home.zf.jcu.cz/~zakkr

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Devrim GUNDUZ 2004-11-23 09:02:58 Re: BUG #1320: 7.3.8 server RPM has file error
Previous Message Peter Eisentraut 2004-11-23 00:39:03 Re: Psql history