File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 5
5
*
6
6
* 1998 Jan Wieck
7
7
*
8
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.5 1999/01/03 05:30:47 momjian Exp $
8
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.6 1999/01/04 11:20:33 wieck Exp $
9
9
*
10
10
* ----------
11
11
*/
@@ -523,6 +523,7 @@ Numeric
523
523
numeric_round (Numeric num , int32 scale )
524
524
{
525
525
int32 typmod ;
526
+ int precision ;
526
527
527
528
/* ----------
528
529
* Handle NULL
@@ -553,7 +554,9 @@ numeric_round(Numeric num, int32 scale)
553
554
* Let numeric() and in turn apply_typmod() do the job
554
555
* ----------
555
556
*/
556
- typmod = (((num -> n_weight + scale + 1 ) << 16 ) | scale ) + VARHDRSZ ;
557
+ precision = MAX (0 , num -> n_weight ) + scale ;
558
+ precision = MIN (precision , NUMERIC_MAX_PRECISION );
559
+ typmod = (((precision + 2 ) << 16 ) | scale ) + VARHDRSZ ;
557
560
return numeric (num , typmod );
558
561
}
559
562
You can’t perform that action at this time.
0 commit comments