forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita898b40
committed
Fix interval_mul() to not produce insane results.
interval_mul() attempts to prevent its calculations from producing sillyresults, but it forgot that zero times infinity yields NaN in IEEEarithmetic. Hence, a case like '1 second'::interval * 'infinity'::float8produced a NaN for the months product, which didn't trigger the rangecheck, resulting in bogus and possibly platform-dependent output.This isn't terribly obvious to the naked eye because if you try thatexact case, you get "interval out of range" which is what you expect--- but if you look closer, the error is coming from interval_out notinterval_mul. interval_mul has allowed a bogus value into the system.Fix by adding isnan tests.Noted while testing Vitaly Burovoy's fix for infinity input toto_timestamp(). Given the lack of field complaints, I doubt thisis worth a back-patch.1 parente511d87 commita898b40
1 file changed
+4
-2
lines changedLines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3351 | 3351 |
| |
3352 | 3352 |
| |
3353 | 3353 |
| |
3354 |
| - | |
| 3354 | + | |
| 3355 | + | |
3355 | 3356 |
| |
3356 | 3357 |
| |
3357 | 3358 |
| |
3358 | 3359 |
| |
3359 | 3360 |
| |
3360 | 3361 |
| |
3361 |
| - | |
| 3362 | + | |
| 3363 | + | |
3362 | 3364 |
| |
3363 | 3365 |
| |
3364 | 3366 |
| |
|
0 commit comments
Comments
(0)