Re: [HACKERS] Numeric overflow problem + patch

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Numeric overflow problem + patch
Date: 2006-09-28 21:19:10
Message-ID: 20060928211910.GI22129@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Thu, Sep 28, 2006 at 05:11:43PM -0400, Tom Lane wrote:
> David Fetter <david(at)fetter(dot)org> writes:
> > ! DETAIL: A field with precision 4, scale 4 must have an absolute value less than 1.
> > [ becomes ]
> > ! DETAIL: A field with precision 4, scale 4 must have an absolute value less than 1 - 5 * 10^-5.
>
> This strikes me as overly pedantic. The message needs to be clear,
> and the proposed change will just confuse people.

It might, but the error that's currently in there is wrong. With the
patch applied, you get:

postgres=# SELECT .99995::NUMERIC(4,4);
ERROR: numeric field overflow
DETAIL: A field with precision 4, scale 4 must have an absolute value less than 1 - 5 * 10^-5.

postgres=# SELECT .9999499999999999999999999999::NUMERIC(4,4);
numeric
---------
0.9999
(1 row)

I'd thought of changing it to the corresponding numeric piece, but
this doesn't work so well for NUMERIC(16,8) and the like.

Cheers,
D
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 2006-09-28 21:19:47 Re: New version of money type
Previous Message AgentM 2006-09-28 21:17:16 Re: Darwin stuff is getting deprecated

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-09-28 21:19:26 Re: contrib/levenshtein() has a bug?
Previous Message Martijn van Oosterhout 2006-09-28 21:16:56 Re: [HACKERS] Numeric overflow problem + patch