Folks, Dennis Björklund and I discovered a little problem with how CVS TIP reports overflows on cast. Please find enclosed a patch which fixes it.
Cheers, D -- David Fetter <[EMAIL PROTECTED]> http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote!
Index: src/backend/utils/adt/numeric.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/numeric.c,v retrieving revision 1.94 diff -c -r1.94 numeric.c *** src/backend/utils/adt/numeric.c 14 Jul 2006 05:28:28 -0000 1.94 --- src/backend/utils/adt/numeric.c 28 Sep 2006 18:47:31 -0000 *************** *** 3217,3227 **** ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("numeric field overflow"), ! errdetail("A field with precision %d, scale %d must have an absolute value less than %s%d.", precision, scale, /* Display 10^0 as 1 */ maxdigits ? "10^" : "", ! maxdigits ? maxdigits : 1))); break; } ddigits -= DEC_DIGITS; --- 3217,3230 ---- ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("numeric field overflow"), ! errdetail("A field with precision %d, scale %d must have an absolute value less than %s%d - 5 * %s%d.", precision, scale, /* Display 10^0 as 1 */ maxdigits ? "10^" : "", ! maxdigits ? maxdigits : 1, ! "10^-", ! scale + 1 ! ))); break; } ddigits -= DEC_DIGITS; Index: src/test/regress/expected/numeric.out =================================================================== RCS file: /projects/cvsroot/pgsql/src/test/regress/expected/numeric.out,v retrieving revision 1.18 diff -c -r1.18 numeric.out *** src/test/regress/expected/numeric.out 25 Jan 2006 18:20:22 -0000 1.18 --- src/test/regress/expected/numeric.out 28 Sep 2006 18:47:31 -0000 *************** *** 688,699 **** INSERT INTO fract_only VALUES (2, '0.1'); INSERT INTO fract_only VALUES (3, '1.0'); -- should fail ERROR: numeric field overflow ! DETAIL: A field with precision 4, scale 4 must have an absolute value less than 1. INSERT INTO fract_only VALUES (4, '-0.9999'); INSERT INTO fract_only VALUES (5, '0.99994'); INSERT INTO fract_only VALUES (6, '0.99995'); -- should fail ERROR: numeric field overflow ! DETAIL: A field with precision 4, scale 4 must have an absolute value less than 1. INSERT INTO fract_only VALUES (7, '0.00001'); INSERT INTO fract_only VALUES (8, '0.00017'); SELECT * FROM fract_only; --- 688,699 ---- INSERT INTO fract_only VALUES (2, '0.1'); INSERT INTO fract_only VALUES (3, '1.0'); -- should fail ERROR: numeric field overflow ! DETAIL: A field with precision 4, scale 4 must have an absolute value less than 1 - 5 * 10^-5. INSERT INTO fract_only VALUES (4, '-0.9999'); INSERT INTO fract_only VALUES (5, '0.99994'); INSERT INTO fract_only VALUES (6, '0.99995'); -- should fail ERROR: numeric field overflow ! DETAIL: A field with precision 4, scale 4 must have an absolute value less than 1 - 5 * 10^-5. INSERT INTO fract_only VALUES (7, '0.00001'); INSERT INTO fract_only VALUES (8, '0.00017'); SELECT * FROM fract_only;
---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match