Check for NUMERIC overflow a second time after rounding
Jan
This commit is contained in:
parent
0d5c832363
commit
bb885dd1a1
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* 1998 Jan Wieck
|
* 1998 Jan Wieck
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.12 1999/05/04 15:50:24 thomas Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.13 1999/05/10 18:17:44 wieck Exp $
|
||||||
*
|
*
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
@ -2399,6 +2399,19 @@ apply_typmod(NumericVar *var, int32 typmod)
|
|||||||
var->ndigits = MAX(0, MIN(i, var->ndigits));
|
var->ndigits = MAX(0, MIN(i, var->ndigits));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------
|
||||||
|
* Check for overflow again - rounding could have raised the
|
||||||
|
* weight.
|
||||||
|
* ----------
|
||||||
|
*/
|
||||||
|
if (var->weight >= maxweight)
|
||||||
|
{
|
||||||
|
free_allvars();
|
||||||
|
elog(ERROR, "overflow on numeric "
|
||||||
|
"ABS(value) >= 10^%d for field with precision %d scale %d",
|
||||||
|
var->weight, precision, scale);
|
||||||
|
}
|
||||||
|
|
||||||
var->rscale = scale;
|
var->rscale = scale;
|
||||||
var->dscale = scale;
|
var->dscale = scale;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user