pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: michael.aiello@asg.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15091: to_number() returns incorrect value
Date: Mon, 26 Feb 2018 12:48:29 -0500
Message-ID: <27576.1519667309@sss.pgh.pa.us> (raw)
In-Reply-To: <151965334143.21242.9862077287740270901@wrigleys.postgresql.org>
References: <151965334143.21242.9862077287740270901@wrigleys.postgresql.org>

=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> When to_number is called with a string that contains a decimal point, but
> there is no decimal indicator in the format string, the decimal digits are
> appended to the integer portion, having the effect of increasing the the
> integer value. 
> This can be reproduced with a simple SELECT, as follows:

> SELECT to_number('123.0', 'FM9999999');
> returns value 1230

[ experiments ... ]  I get the same result on Oracle, so I'd say this
is the "correct" behavior.

> by comparison, a decimal indicator in the format returns the correct
> value:

> SELECT to_number('123.0', 'FM99999D999');
> returns 123.0

On the other hand, Oracle also returns 1230 for this case :-(.
But that seems to be a locale issue --- if I change the D to "."
I get the expected result 123.

Tested at
http://rextester.com/l/oracle_online_compiler

			regards, tom lane




view thread (9+ messages)  latest in thread

Message-ID: <27576.1519667309@sss.pgh.pa.us>
Permalink:  ../27576.1519667309@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27576.1519667309@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael.aiello@asg.com
  Subject: Re: BUG #15091: to_number() returns incorrect value
  In-Reply-To: <27576.1519667309@sss.pgh.pa.us>
  References: <151965334143.21242.9862077287740270901@wrigleys.postgresql.org> <27576.1519667309@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox