Re: BUG #3506: to_number silently ignore characters

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Laurent Martelli <lmartelli(at)seditel(dot)fr>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3506: to_number silently ignore characters
Date: 2007-08-02 19:09:11
Message-ID: 46B22BD7.5040508@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Koczan 2007-08-02 19:12:45 Re: BUG #3504: Some listening sessions never return from writing, problems ensue
Previous Message Peter Koczan 2007-08-02 19:06:51 Re: BUG #3504: Some listening sessions never return from writing, problems ensue