Re: numeric field overflow

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: "pgsql-general(at)postgresql(dot)org mailing list" <pgsql-general(at)postgresql(dot)org>
Subject: Re: numeric field overflow
Date: 2009-10-06 06:26:03
Message-ID: D929343B-E526-4999-871E-EE2B89F5236B@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Oct 5, 2009, at 11:20 PM, Nurzhan Kirbassov wrote:
> So, does the precision part of the numeric type really means number of
> digits to the left of the decimal point, or what ?

NUMERIC is behaving as documented. The way to think of it is when you
are inserting:

INSERT INTO test.test VALUES (10000)

into a NUMERIC(5,1), what you are doing is inserting:

INSERT INTO test.test VALUES (10000.0)

10000.0 has six significant digits, rather than five, so the insert
fails.
--
-- Christophe Pettus
xof(at)thebuild(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stuart Bishop 2009-10-06 06:29:07 Re: attempted to lock invisible tuple - PG 8.4.1
Previous Message Nurzhan Kirbassov 2009-10-06 06:20:11 numeric field overflow