From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Thomas O'Connell <tfo@monsterlabs.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] double precision to numeric overflow error
Date: Tue, 7 Jan 2003 15:36:44 -0800 (PST)
Message-ID: <20030107152951.R67168-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <tfo-DC0904.17120807012003@news.hub.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone23.bigpanda.com, tfo@monsterlabs.com, pgsql-general@postgresql.org
Subject: Re: [SQL] double precision to numeric overflow error
In-Reply-To: <20030107152951.R67168-100000@megazone23.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox