Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2A266476611; Tue, 7 Jan 2003 22:01:06 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id ACBCA474E53; Tue, 7 Jan 2003 22:01:05 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 9B01843A74A; Tue, 7 Jan 2003 22:01:05 -0500 (EST) From: Thomas O'Connell X-Newsgroups: comp.databases.postgresql.sql, , comp.databases.postgresql.general Subject: Re: double precision to numeric overflow error Date: Tue, 07 Jan 2003 21:01:09 -0600 Organization: Monster Labs, Inc. Lines: 29 Message-ID: References: <20030107152951.R67168-100000@megazone23.bigpanda.com> X-Complaints-To: usenet@news.hub.org User-Agent: MT-NewsWatcher/3.3b1 (PPC Mac OS X) To: pgsql-general@postgresql.org, pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/272 X-Sequence-Number: 35393 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.R67168-100000@megazone23.bigpanda.com>, sszabo@megazone23.bigpanda.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