Bug #31013 Fractions used with INTERVAL are rounded without error or warning
Submitted: 14 Sep 2007 6:04 Modified: 14 Sep 2007 12:59
Reporter: Tobias Asplund
Status: Verified
Category:Server: Types Severity:S3 (Non-critical)
Version:5.0bk, 5.1bk OS:Any
Assigned to: Alexey Kopytov Target Version:
Triage: Triaged: D2 (Serious) / R3 (Medium) / E3 (Medium)

[14 Sep 2007 6:04] Tobias Asplund
Description:
The server accepts fractional numbers for the the INTERVAL temporal functionality, but
rounds it quietly without any indication it actually does.

How to repeat:
DROP TABLE IF EXISTS t1bug;
CREATE TABLE t1bug ( a DATETIME );
SET SQL_MODE = 'STRICT_ALL_TABLES';
INSERT INTO t1bug VALUES (NOW() + INTERVAL 0.5 HOUR), (NOW() + INTERVAL 0.4 HOUR);
SELECT * FROM t1bug;
DROP TABLE t1bug;

Suggested fix:
Since it accepts something like 1/2 HOUR it should (especially in STRICT mode) let me
know it's not using the number I submitted.
[14 Sep 2007 12:59] Hartmut Holzgraefe
Verified on Linux with both current 5.0 and 5.1 bk builds
[14 Sep 2007 13:00] Hartmut Holzgraefe
mysqltest test case (using fixed dates instead of NOW())

Attachment: bug31013.tgz (application/x-gtar, text), 861 bytes.

[4 Jun 13:36] Konstantin Osipov
See also Bug#8523