Bug #25887 | Documentation for return types of ceiling and floor is wrong | ||
---|---|---|---|
Submitted: | 27 Jan 2007 4:36 | Modified: | 20 Apr 2007 23:47 |
Reporter: | Mark Callaghan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S2 (Serious) |
Version: | 5.0.36-BK | OS: | Linux (Linux) |
Assigned to: | Alexey Kopytov | CPU Architecture: | Any |
Tags: | bfsm_2007_02_01, ceiling, documentation, floor |
[27 Jan 2007 4:36]
Mark Callaghan
[27 Jan 2007 5:06]
Paul DuBois
The behavior is version specific. The return type is bigint (as documented) in MySQL 4.0 and 4.1. Shorter test script: drop table if exists d, t; create table d (d double); insert into d values (1.1); create table t as select floor(d), ceiling(d) from d; show create table t\G Result in 4.0 or 4.1: *************************** 1. row *************************** Table: t Create Table: CREATE TABLE `t` ( `floor(d)` bigint(17) default NULL, `ceiling(d)` bigint(17) default NULL ) TYPE=MyISAM Result in 5.0 or 5.1: *************************** 1. row *************************** Table: t Create Table: CREATE TABLE `t` ( `floor(d)` double(17,0) default NULL, `ceiling(d)` double(17,0) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 The result changes at version 5.0.3. In 5.0.2, the return type is bigint; in 5.0.3, it's double. This might have something to do with the introduction of precision math in 5.0.3. It's unclear whether the change in return type is deliberate. If so, it needs to be documented. Otherwise, it is a bug that needs to be fixed. (I vote for the latter since the functions are supposed to return integer values.)
[28 Jan 2007 10:03]
Valeriy Kravchuk
Verified just as described with latest 5.0.36-BK on Linux. I think, it is a (serious enough) bug, and not just a documentation request. There is no good reason to use DOUBLE data type for something that is INTEGER by definition.
[20 Apr 2007 23:47]
Timothy Smith
The documentation for Mathematical Functions has been updated to more correctly describe the FLOOR/CEILING result types. Thank you for the bug report!