pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tommaso.sala@cla-it.eu
To: pgsql-bugs@postgresql.org
Subject: BUG #12053: Strange behavior for numeric types with unspecified precision-scale
Date: Tue, 25 Nov 2014 11:15:29 +0000
Message-ID: <20141125111529.15508.34881@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      12053
Logged by:          Tommaso Sala
Email address:      tommaso.sala@cla-it.eu
PostgreSQL version: 9.3.0
Operating system:   Windows Server 2008
Description:        

We found out that PgSql acts weirdly when using "numeric" type with
UN-specified precision and scale
Writing 0.001 via a .net DataAdapter to a numeric column with unspecified
precision-scale results in a weird 0.00 value:
if you later
SELECT "that value" + 0.001 you get 0.002,
but if you
SELECT "that value" * 2 you get 0.00
and
SELECT "that value" * 5 gives a rounded 0.01
Value in the database is correct, since if you TO_CHAR it, it gets printed
correctly as .001, but if you SELECT it, you get 0.00
Also, the weirder thing is that 0.000001 doesn't get truncated!
Specifying precision and scale for that column, solves the issue.
Bug is described here:
http://stackoverflow.com/questions/27109361/writing-0-001-to-postgres-9-x-via-data-adapter-results-i...


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (10+ messages)  latest in thread

Message-ID: <20141125111529.15508.34881@wrigleys.postgresql.org>
Permalink:  ../20141125111529.15508.34881@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20141125111529.15508.34881@wrigleys.postgresql.org

 · 

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: tommaso.sala@cla-it.eu
  Subject: Re: BUG #12053: Strange behavior for numeric types with unspecified precision-scale
  In-Reply-To: <20141125111529.15508.34881@wrigleys.postgresql.org>
  References: <20141125111529.15508.34881@wrigleys.postgresql.org>

* 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