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