Re: Silent truncation of numeric values.

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Silent truncation of numeric values.
Date: 2003-11-22 16:27:29
Message-ID: 20031122082320.O14063@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Sat, 22 Nov 2003, Rajesh Kumar Mallah wrote:

> How come numeric(10,2) accepting value 10.011 and truncating the .001
> part ? Shudnt' it be complaining , i am not sure.

AFAICS, the spec says that implementation-defined rounding or truncation
occurs if least significant digits would be lost. It appears to only be
an error if most significant digits would be lost.

For example:
If an assignment would result in a loss of the most significant digits,
an exception condition is raised. If least significant digits are lost,
implementation-defined rounding or truncating occurs with no exception
condition being raised.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Randolf Richardson, DevNet SysOp 29 2003-11-22 18:14:36 Re: Picture with Postgres and Delphi
Previous Message tim 2003-11-22 16:14:52 Connecting Openoffice Postgres