NUMERIC type conversions leave much to be desired - Mailing list pgsql-hackers

From Tom Lane
Subject NUMERIC type conversions leave much to be desired
Date
Msg-id 17681.926115287@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
With fairly current sources:

regression=> create table dnum (f1 numeric(10,2));
CREATE
regression=> insert into dnum values ('12.34');
ERROR:  overflow on numeric ABS(value) >= 10^1 for field with precision 31491 scale 52068
regression=> insert into dnum1 values ('12.34'::numeric);
ERROR:  overflow on numeric ABS(value) >= 10^1 for field with precision 31491 scale 52132
regression=> insert into dnum1 values (12.34::numeric);
ERROR:  parser_typecast: cannot cast this expression to type 'numeric'
regression=> insert into dnum1 values (12.34);
INSERT 950499 1

I've not put in Thomas' proposed change for handling out-of-range
constants; I don't think it'd change any of these cases anyway.

BTW, why is there no regression test for NUMERIC?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] pg_dump problem?
Next
From: Tom Lane
Date:
Subject: pg_dump doesn't dump NUMERIC precision info