Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbb885dd

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
Check for NUMERIC overflow a second time after rounding
Jan
1 parent0d5c832 commitbb885dd

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

‎src/backend/utils/adt/numeric.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
*1998 Jan Wieck
77
*
8-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.12 1999/05/04 15:50:24 thomas Exp $
8+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.13 1999/05/10 18:17:44 wieck Exp $
99
*
1010
* ----------
1111
*/
@@ -2399,6 +2399,19 @@ apply_typmod(NumericVar *var, int32 typmod)
23992399
var->ndigits=MAX(0,MIN(i,var->ndigits));
24002400
}
24012401

2402+
/* ----------
2403+
* Check for overflow again - rounding could have raised the
2404+
* weight.
2405+
* ----------
2406+
*/
2407+
if (var->weight >=maxweight)
2408+
{
2409+
free_allvars();
2410+
elog(ERROR,"overflow on numeric "
2411+
"ABS(value) >= 10^%d for field with precision %d scale %d",
2412+
var->weight,precision,scale);
2413+
}
2414+
24022415
var->rscale=scale;
24032416
var->dscale=scale;
24042417
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp