Commit f88086c
committed
fix: generate_series overflow panics at i64 boundary and out-of-range dates
Two overflow fixes in the generate_series/range table functions:
- Integer series: advancing past i64::MAX (or i64::MIN for negative
steps) panicked in debug builds and silently wrapped in release.
advance() now uses checked_add and clamps the series end so iteration
stops after the last reachable value, matching PostgreSQL/DuckDB
(e.g. generate_series(9223372036854775806, 9223372036854775807, 2)
returns one row 9223372036854775806).
- Date series: converting Date32 days to timestamp nanoseconds used an
unchecked multiplication, panicking at planning time for dates outside
the nanosecond timestamp range. It now returns a planning error.
Supersedes #22250 (closed unmerged); the integer-side approach follows
the one approved there.
Closes #22208, closes #22193.1 parent 2f25454 commit f88086c
2 files changed
Lines changed: 81 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
84 | 89 | | |
85 | 90 | | |
86 | 91 | | |
| |||
100 | 105 | | |
101 | 106 | | |
102 | 107 | | |
103 | | - | |
104 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
105 | 121 | | |
106 | 122 | | |
107 | 123 | | |
| |||
155 | 171 | | |
156 | 172 | | |
157 | 173 | | |
158 | | - | |
| 174 | + | |
159 | 175 | | |
160 | 176 | | |
161 | 177 | | |
| |||
417 | 433 | | |
418 | 434 | | |
419 | 435 | | |
420 | | - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
421 | 445 | | |
422 | 446 | | |
423 | 447 | | |
| |||
740 | 764 | | |
741 | 765 | | |
742 | 766 | | |
743 | | - | |
744 | | - | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
745 | 781 | | |
746 | 782 | | |
747 | 783 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
200 | 237 | | |
201 | 238 | | |
202 | 239 | | |
| |||
0 commit comments