Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 84EDB476D8F; Tue, 7 Jan 2003 18:37:05 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 021DA4763D5; Tue, 7 Jan 2003 18:36:43 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id E19FCD605; Tue, 7 Jan 2003 15:36:44 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id D75035C04; Tue, 7 Jan 2003 15:36:44 -0800 (PST) Date: Tue, 7 Jan 2003 15:36:44 -0800 (PST) From: Stephan Szabo To: Thomas O'Connell Cc: , Subject: Re: [SQL] double precision to numeric overflow error In-Reply-To: Message-ID: <20030107152951.R67168-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/266 X-Sequence-Number: 35387 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