Re: double precision to numeric overflow error - Mailing list pgsql-sql

From Thomas O'Connell
Subject Re: double precision to numeric overflow error
Date
Msg-id tfo-E9C401.23361207012003@news.hub.org
Whole thread Raw
In response to Re: [GENERAL] double precision to numeric overflow error  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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.1041999309@sss.pgh.pa.us>, tgl@sss.pgh.pa.us (Tom Lane)
wrote:

> "Thomas O'Connell" <tfo@monsterlabs.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...

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] double precision to numeric overflow error
Next
From: Alan Gutierrez
Date:
Subject: Re: SQL list table names