forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0325565
committed
Adjust the integer overflow tests in the numeric code.
Formerly, the numeric code tested whether an integer value of a largertype would fit in a smaller type by casting it to the smaller type andthen testing if the reverse conversion produced the original value.That's perfectly fine, except that it caused a test failure onbuildfarm animal castoroides, most likely due to a compiler bug.Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. Thatmatches existing code in other places, such as int84(), which is morewidely tested, and so is less likely to go wrong.While at it, add regression tests covering the numeric-to-int8/4/2conversions, and adjust the recently added tests to the style of434ddfb (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 parentc3a135b commit0325565
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 | |
|---|---|---|---|
| |||
4228 | 4228 | | |
4229 | 4229 | | |
4230 | 4230 | | |
| 4231 | + | |
| 4232 | + | |
| 4233 | + | |
4231 | 4234 | | |
4232 | 4235 | | |
4233 | 4236 | | |
4234 | | - | |
4235 | | - | |
| 4237 | + | |
4236 | 4238 | | |
4237 | 4239 | | |
4238 | 4240 | | |
| |||
4312 | 4314 | | |
4313 | 4315 | | |
4314 | 4316 | | |
4315 | | - | |
4316 | | - | |
4317 | | - | |
4318 | | - | |
4319 | | - | |
| 4317 | + | |
4320 | 4318 | | |
4321 | 4319 | | |
4322 | 4320 | | |
4323 | 4321 | | |
| 4322 | + | |
| 4323 | + | |
| 4324 | + | |
4324 | 4325 | | |
4325 | 4326 | | |
4326 | 4327 | | |
| |||
10147 | 10148 | | |
10148 | 10149 | | |
10149 | 10150 | | |
10150 | | - | |
10151 | | - | |
10152 | | - | |
10153 | | - | |
| 10151 | + | |
10154 | 10152 | | |
10155 | 10153 | | |
10156 | 10154 | | |
10157 | 10155 | | |
10158 | 10156 | | |
10159 | 10157 | | |
10160 | 10158 | | |
10161 | | - | |
| 10159 | + | |
10162 | 10160 | | |
10163 | 10161 | | |
10164 | 10162 | | |
| |||
| 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 | | |
| |||
2365 | 2414 | | |
2366 | 2415 | | |
2367 | 2416 | | |
2368 | | - | |
| 2417 | + | |
2369 | 2418 | | |
2370 | 2419 | | |
2371 | | - | |
| 2420 | + | |
2372 | 2421 | | |
2373 | 2422 | | |
2374 | 2423 | | |
| |||
2384 | 2433 | | |
2385 | 2434 | | |
2386 | 2435 | | |
2387 | | - | |
| 2436 | + | |
2388 | 2437 | | |
2389 | 2438 | | |
2390 | | - | |
| 2439 | + | |
2391 | 2440 | | |
2392 | 2441 | | |
2393 | 2442 | | |
| |||
2557 | 2606 | | |
2558 | 2607 | | |
2559 | 2608 | | |
2560 | | - | |
| 2609 | + | |
2561 | 2610 | | |
2562 | 2611 | | |
2563 | | - | |
| 2612 | + | |
2564 | 2613 | | |
2565 | 2614 | | |
2566 | | - | |
| 2615 | + | |
2567 | 2616 | | |
2568 | 2617 | | |
2569 | | - | |
| 2618 | + | |
2570 | 2619 | | |
2571 | 2620 | | |
2572 | 2621 | | |
| |||
| 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 | | |
| |||
1099 | 1113 | | |
1100 | 1114 | | |
1101 | 1115 | | |
1102 | | - | |
| 1116 | + | |
1103 | 1117 | | |
1104 | 1118 | | |
1105 | 1119 | | |
1106 | 1120 | | |
1107 | | - | |
| 1121 | + | |
1108 | 1122 | | |
1109 | 1123 | | |
1110 | 1124 | | |
| |||
1154 | 1168 | | |
1155 | 1169 | | |
1156 | 1170 | | |
1157 | | - | |
1158 | | - | |
| 1171 | + | |
| 1172 | + | |
1159 | 1173 | | |
1160 | 1174 | | |
1161 | 1175 | | |
| |||
0 commit comments
Comments
(0)