1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-11 00:12:06 +03:00
Files
postgres/src/backend
Tom Lane a898b409f6 Fix interval_mul() to not produce insane results.
interval_mul() attempts to prevent its calculations from producing silly
results, but it forgot that zero times infinity yields NaN in IEEE
arithmetic.  Hence, a case like '1 second'::interval * 'infinity'::float8
produced a NaN for the months product, which didn't trigger the range
check, resulting in bogus and possibly platform-dependent output.

This isn't terribly obvious to the naked eye because if you try that
exact case, you get "interval out of range" which is what you expect
--- but if you look closer, the error is coming from interval_out not
interval_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 to
to_timestamp().  Given the lack of field complaints, I doubt this
is worth a back-patch.
2016-03-29 17:21:12 -04:00
..
2016-01-19 17:40:15 -03:00
2015-06-28 23:56:55 -04:00
2016-01-02 13:33:40 -05:00
2016-03-28 20:55:15 -04:00
2016-03-23 23:01:35 -03:00