From: | tommaso(dot)sala(at)cla-it(dot)eu |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #12053: Strange behavior for numeric types with unspecified precision-scale |
Date: | 2014-11-25 11:15:29 |
Message-ID: | 20141125111529.15508.34881@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 12053
Logged by: Tommaso Sala
Email address: tommaso(dot)sala(at)cla-it(dot)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-in-a-weird-0-00-value
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2014-11-25 12:52:52 | Re: [PATCH] initdb: Option description. |
Previous Message | Jamie Koceniak | 2014-11-25 03:39:45 | Re: BUG #12050: Orphaned base files |