Re: double precision to numeric overflow error

From: Thomas O'Connell <tfo(at)monsterlabs(dot)com>
To: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: double precision to numeric overflow error
Date: 2003-01-08 05:36:12
Message-ID: tfo-E9C401.23361207012003@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Well, it would've immediately (rather than the several minutes it took)
given away the problem if it read something like:

ERROR: overflow caused by cast of double precision value to numeric
without sufficient precision, scale (15, 6)

or even, depending on how much detail is available or how much worth
assigned to error reporting:

ERROR: a double precision value requiring at least precision 16 cannot
be cast to a numeric value with precision 15, scale 6.

i understand the need for balancing correctness with readability,
though. if there's anything technically incorrect about either of my
proprosals, they clearly should not be used.

i'm usually a fan of breaking error messages down as far as the details
will allow them to be correctly broken down.

in this situtation, it seems like it is this specific cast (double
precision -> numeric) in this specific scenario (insufficient precision)
that generates the error.

unfortunately, i haven't read the code... :(

-tfo

In article <726(dot)1041999309(at)sss(dot)pgh(dot)pa(dot)us>, tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
wrote:

> "Thomas O'Connell" <tfo(at)monsterlabs(dot)com> writes:
> > Indeed, it seems as though my inability to count digits was the real
> > problem. Still, does this not strike anyone as a somewhat abstruse error
> > message?
>
> How would you phrase it?
>
> > ERROR: overflow on numeric ABS(value) >= 10^9 for field with precision
> > 15 scale 6
>
> It's technically correct, but if you think you can word it better,
> let's see your proposal...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Naeslund(f) 2003-01-08 09:18:32 Re: PostgreSQL + Visual Basic .NET
Previous Message Joe Conway 2003-01-08 04:47:28 Re: Binary data migration from MSSQL

Browse pgsql-sql by date

  From Date Subject
Next Message Alan Gutierrez 2003-01-08 09:34:17 Re: SQL list table names
Previous Message Tom Lane 2003-01-08 04:15:09 Re: double precision to numeric overflow error