Re: BUG #3506: to_number silently ignore characters

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: BUG #3506: to_number silently ignore characters
Дата
Msg-id 46B22BD7.5040508@enterprisedb.com
обсуждение исходный текст
Ответ на BUG #3506: to_number silently ignore characters  ("Laurent Martelli" <lmartelli@seditel.fr>)
Ответы Re: BUG #3506: to_number silently ignore characters
Список pgsql-bugs
Laurent Martelli wrote:
> to_number('123.0','999999') returns 1230, at least on version 7.4 and 8.1. I
> think it should return 123 or raise an error.

to_number will silently ignore any character that doesn't match the
pattern. That can be confusing, and not generally a very bright idea in
applications, but we can't really change the behavior because that could
break existing applications.

You can use the pattern '999999.' to get the behavior you want (returns
123).

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #3504: Some listening sessions never return from writing, problems ensue
Следующее
От: "Peter Koczan"
Дата:
Сообщение: Re: BUG #3504: Some listening sessions never return from writing, problems ensue