Re: select to_number('1,000', '999,999');
От | Stephan Szabo |
---|---|
Тема | Re: select to_number('1,000', '999,999'); |
Дата | |
Msg-id | 20041122054509.I88957@megazone.bigpanda.com обсуждение исходный текст |
Ответ на | Re: select to_number('1,000', '999,999'); (Stephan Szabo <sszabo@megazone.bigpanda.com>) |
Ответы |
Re: select to_number('1,000', '999,999');
|
Список | pgsql-bugs |
On Mon, 22 Nov 2004, Stephan Szabo wrote: > On Mon, 22 Nov 2004, David Schweikert wrote: > > > 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)? > > No, but I think you're supposed to use FM in such cases. > > select to_number(1000, 'FM999,999'); Of course, I don't think the fact that it does that is actually documented in the 7.4 docs now that I look. I must have just run into it through experimentation, so I wonder if that's actually intended behavior or not.
В списке pgsql-bugs по дате отправления: