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 03:01:09
Message-ID: tfo-EC7463.21010907012003@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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?

-tfo

In article <20030107152951(dot)R67168-100000(at)megazone23(dot)bigpanda(dot)com>,
sszabo(at)megazone23(dot)bigpanda(dot)com (Stephan Szabo) wrote:

> On Tue, 7 Jan 2003, Thomas O'Connell wrote:
>
> > is this expected behavior? if so, then why?
>
> I'd guess so if the timestamp value's integer part is
> 10 digits long since I believe trying to fit that into
> a numeric(15,6) wouldn't work (9 digits . 6 digits).
>
> > db=# create table foo( col timestamp );
> > db=# select cast( extract( epoch from col ) as numeric( 15, 6 ) ) from
> > foo;
> > date_part
> > -----------
> > (0 rows)
> > db=# insert into foo values( current_timestamp );
> > INSERT 1705954 1
> > db=# select cast( extract( epoch from col ) as numeric( 15, 6 ) ) from
> > foo;
> > ERROR: overflow on numeric ABS(value) >= 10^9 for field with precision
> > 15 scale 6

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2003-01-08 03:20:25 shared buffers in config
Previous Message davoid 2003-01-08 02:54:38 PostgreSQL + Visual Basic .NET

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-01-08 04:15:09 Re: double precision to numeric overflow error
Previous Message Stephan Szabo 2003-01-07 23:36:44 Re: [SQL] double precision to numeric overflow error