forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfa85411
committed
Fix loss of fractional digits for large values in cash_numeric().
Money values exceeding about 18 digits (depending on lc_monetary)could be inaccurately converted to numeric, due to select_div_scale()deciding it didn't need to compute any fractional digits. Forceits hand by setting the dscale of one division input to equal thenumber of fractional digits we need.In passing, rearrange the logic to not do useless work in localeswhere money values are considered integral.Per bug #15925 from Slawomir Chodnicki. Back-patch to all supportedbranches.Discussion:https://postgr.es/m/15925-da9953e2674bb5c8@postgresql.org1 parented304d1 commitfa85411
3 files changed
+58
-22
lines changedLines changed: 38 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1033 | 1033 |
| |
1034 | 1034 |
| |
1035 | 1035 |
| |
1036 |
| - | |
| 1036 | + | |
1037 | 1037 |
| |
1038 |
| - | |
1039 |
| - | |
1040 |
| - | |
1041 |
| - | |
1042 |
| - | |
1043 | 1038 |
| |
1044 | 1039 |
| |
1045 | 1040 |
| |
1046 | 1041 |
| |
1047 | 1042 |
| |
1048 | 1043 |
| |
1049 | 1044 |
| |
1050 |
| - | |
1051 |
| - | |
1052 |
| - | |
1053 |
| - | |
1054 |
| - | |
1055 |
| - | |
1056 |
| - | |
1057 |
| - | |
1058 |
| - | |
| 1045 | + | |
| 1046 | + | |
1059 | 1047 |
| |
1060 |
| - | |
1061 |
| - | |
1062 |
| - | |
1063 |
| - | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
1064 | 1082 |
| |
1065 |
| - | |
| 1083 | + | |
1066 | 1084 |
| |
1067 | 1085 |
| |
1068 | 1086 |
| |
|
Lines changed: 15 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
| 4 | + | |
| 5 | + | |
4 | 6 |
| |
5 | 7 |
| |
6 | 8 |
| |
| |||
476 | 478 |
| |
477 | 479 |
| |
478 | 480 |
| |
479 |
| - | |
| 481 | + | |
480 | 482 |
| |
481 | 483 |
| |
482 | 484 |
| |
| |||
489 | 491 |
| |
490 | 492 |
| |
491 | 493 |
| |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + |
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
| 4 | + | |
| 5 | + | |
4 | 6 |
| |
5 | 7 |
| |
6 | 8 |
| |
| |||
122 | 124 |
| |
123 | 125 |
| |
124 | 126 |
| |
125 |
| - | |
| 127 | + | |
126 | 128 |
| |
127 | 129 |
| |
| 130 | + | |
| 131 | + |
0 commit comments
Comments
(0)