Commit 54bd1e4
committed
Handle integer overflow in interval justification functions.
justify_interval, justify_hours, and justify_days didn't check for
overflow when promoting hours to days or days to months; but that's
possible when the upper field's value is already large. Detect and
report any such overflow.
Also, we can avoid unnecessary overflow in some cases in justify_interval
by pre-justifying the days field. (Thanks to Nathan Bossart for this
idea.)
Joe Koshakow
Discussion: https://postgr.es/m/CAAvxfHeNqsJ2xYFbPUf_8nNQUiJqkag04NW6aBQQ0dbZsxfWHA@mail.gmail.com1 parent a59c795 commit 54bd1e4
File tree
3 files changed
+79
-4
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+79
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2717 | 2717 | | |
2718 | 2718 | | |
2719 | 2719 | | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + | |
2720 | 2738 | | |
2721 | | - | |
| 2739 | + | |
2722 | 2740 | | |
2723 | 2741 | | |
2724 | 2742 | | |
2725 | | - | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
2726 | 2747 | | |
2727 | 2748 | | |
2728 | 2749 | | |
| |||
2772 | 2793 | | |
2773 | 2794 | | |
2774 | 2795 | | |
2775 | | - | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
2776 | 2800 | | |
2777 | 2801 | | |
2778 | 2802 | | |
| |||
2808 | 2832 | | |
2809 | 2833 | | |
2810 | 2834 | | |
2811 | | - | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
2812 | 2839 | | |
2813 | 2840 | | |
2814 | 2841 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
399 | 403 | | |
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
403 | 407 | | |
404 | 408 | | |
405 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
406 | 442 | | |
407 | 443 | | |
408 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
155 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
156 | 168 | | |
157 | 169 | | |
158 | 170 | | |
| |||
0 commit comments