Commit 2642df9
committed
Adjust the integer overflow tests in the numeric code.
Formerly, the numeric code tested whether an integer value of a larger
type would fit in a smaller type by casting it to the smaller type and
then testing if the reverse conversion produced the original value.
That's perfectly fine, except that it caused a test failure on
buildfarm animal castoroides, most likely due to a compiler bug.
Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That
matches existing code in other places, such as int84(), which is more
widely tested, and so is less likely to go wrong.
While at it, add regression tests covering the numeric-to-int8/4/2
conversions, and adjust the recently added tests to the style of
434ddfb (on the v11 branch) to make failures easier to diagnose.
Per buildfarm via Tom Lane, reviewed by Tom Lane.
Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us1 parent ba4eb86 commit 2642df9
File tree
3 files changed
+85
-24
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+85
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4289 | 4289 | | |
4290 | 4290 | | |
4291 | 4291 | | |
| 4292 | + | |
| 4293 | + | |
| 4294 | + | |
4292 | 4295 | | |
4293 | 4296 | | |
4294 | 4297 | | |
4295 | | - | |
4296 | | - | |
| 4298 | + | |
4297 | 4299 | | |
4298 | 4300 | | |
4299 | 4301 | | |
| |||
4373 | 4375 | | |
4374 | 4376 | | |
4375 | 4377 | | |
4376 | | - | |
4377 | | - | |
4378 | | - | |
4379 | | - | |
4380 | | - | |
| 4378 | + | |
4381 | 4379 | | |
4382 | 4380 | | |
4383 | 4381 | | |
4384 | 4382 | | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
4385 | 4386 | | |
4386 | 4387 | | |
4387 | 4388 | | |
| |||
10186 | 10187 | | |
10187 | 10188 | | |
10188 | 10189 | | |
10189 | | - | |
10190 | | - | |
10191 | | - | |
10192 | | - | |
| 10190 | + | |
10193 | 10191 | | |
10194 | 10192 | | |
10195 | 10193 | | |
10196 | 10194 | | |
10197 | 10195 | | |
10198 | 10196 | | |
10199 | 10197 | | |
10200 | | - | |
| 10198 | + | |
10201 | 10199 | | |
10202 | 10200 | | |
10203 | 10201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1154 | 1154 | | |
1155 | 1155 | | |
1156 | 1156 | | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
1157 | 1206 | | |
1158 | 1207 | | |
1159 | 1208 | | |
| |||
2428 | 2477 | | |
2429 | 2478 | | |
2430 | 2479 | | |
2431 | | - | |
| 2480 | + | |
2432 | 2481 | | |
2433 | 2482 | | |
2434 | | - | |
| 2483 | + | |
2435 | 2484 | | |
2436 | 2485 | | |
2437 | 2486 | | |
| |||
2447 | 2496 | | |
2448 | 2497 | | |
2449 | 2498 | | |
2450 | | - | |
| 2499 | + | |
2451 | 2500 | | |
2452 | 2501 | | |
2453 | | - | |
| 2502 | + | |
2454 | 2503 | | |
2455 | 2504 | | |
2456 | 2505 | | |
| |||
2620 | 2669 | | |
2621 | 2670 | | |
2622 | 2671 | | |
2623 | | - | |
| 2672 | + | |
2624 | 2673 | | |
2625 | 2674 | | |
2626 | | - | |
| 2675 | + | |
2627 | 2676 | | |
2628 | 2677 | | |
2629 | | - | |
| 2678 | + | |
2630 | 2679 | | |
2631 | 2680 | | |
2632 | | - | |
| 2681 | + | |
2633 | 2682 | | |
2634 | 2683 | | |
2635 | 2684 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
776 | 790 | | |
777 | 791 | | |
778 | 792 | | |
| |||
1133 | 1147 | | |
1134 | 1148 | | |
1135 | 1149 | | |
1136 | | - | |
| 1150 | + | |
1137 | 1151 | | |
1138 | 1152 | | |
1139 | 1153 | | |
1140 | 1154 | | |
1141 | | - | |
| 1155 | + | |
1142 | 1156 | | |
1143 | 1157 | | |
1144 | 1158 | | |
| |||
1188 | 1202 | | |
1189 | 1203 | | |
1190 | 1204 | | |
1191 | | - | |
1192 | | - | |
| 1205 | + | |
| 1206 | + | |
1193 | 1207 | | |
1194 | 1208 | | |
1195 | 1209 | | |
| |||
0 commit comments