Bug #80873 Function FLOOR(CEIL()) truncates bigint unsigned
Submitted: 29 Mar 2016 2:40 Modified: 9 Apr 2016 16:10
Reporter: Su Dylan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.7.8, 5.7.9, 5.6.29, 5.7.11 OS:Any
Assigned to: CPU Architecture:Any

[29 Mar 2016 2:40] Su Dylan
Description:
Output:
=====
mysql> select floor(ceil(12345678901234567890));
+-----------------------------------+
| floor(ceil(12345678901234567890)) |
+-----------------------------------+
|               9223372036854775807 |
+-----------------------------------+
1 row in set, 1 warning (0.00 sec)

Problem:
=====
12345678901234567890 is expected.

How to repeat:
select floor(ceil(12345678901234567890));

Suggested fix:
12345678901234567890 is returned.
[29 Mar 2016 4:53] MySQL Verification Team
Hello Su Dylan,

Thank you for the report and test case.
Observed this with daily builds of 5.5, 5.6 and 5.7.

Thanks,
Umesh
[29 Mar 2016 4:53] MySQL Verification Team
-- 5.7.9

[umshastr@hod03]/export/umesh/server/binaries/mysql-advanced-5.7.9/mysql-test: ./mtr 80873
Logging: ./mtr  80873
MySQL Version 5.7.9
Checking supported features...
 - SSL connections supported
Collecting tests...
Checking leftover processes...
Removing old var directory...
Creating var directory '/export/umesh/server/binaries/mysql-advanced-5.7.9/mysql-test/var'...
Installing system database...

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
#
# Bug#80873 - Function FLOOR(CEIL()) truncates bigint unsigned
#
select floor(ceil(12345678901234567890));
floor(ceil(12345678901234567890))
9223372036854775807 <-------- expected 12345678901234567890
main.80873                               [ pass ]
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.000 of 5 seconds executing testcases

Completed: All 1 tests were successful.

-- 5.7.13 daily build

[umshastr@hod03]/export/umesh/server/binaries/mysql-advanced-5.7.13/mysql-test: ./mtr 80873
Logging: ./mtr  80873
MySQL Version 5.7.13
Checking supported features...
 - SSL connections supported
Collecting tests...
Checking leftover processes...
Removing old var directory...
Creating var directory '/export/umesh/server/binaries/mysql-advanced-5.7.13/mysql-test/var'...
Installing system database...

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
#
# Bug#80873 - Function FLOOR(CEIL()) truncates bigint unsigned
#
select floor(ceil(12345678901234567890));
floor(ceil(12345678901234567890))
9223372036854775807 <-------- expected 12345678901234567890
main.80873                               [ pass ]      1
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.001 of 4 seconds executing testcases

Completed: All 1 tests were successful.

-- 5.6.31

[umshastr@hod03]/export/umesh/server/binaries/mysql-advanced-5.6.31/mysql-test: ./mtr 80873
Logging: ./mtr  80873
2016-03-29 06:49:26 0 [Note] /export/umesh/server/binaries/mysql-advanced-5.6.31/bin/mysqld (mysqld 5.6.31-enterprise-commercial-advanced) starting as process 9787 ...
2016-03-29 06:49:26 9787 [Note] Plugin 'FEDERATED' is disabled.
2016-03-29 06:49:26 9787 [Note] Binlog end
2016-03-29 06:49:26 9787 [Note] Shutting down plugin 'CSV'
2016-03-29 06:49:26 9787 [Note] Shutting down plugin 'MyISAM'
MySQL Version 5.6.31
Checking supported features...
 - SSL connections supported
Collecting tests...
Removing old var directory...
Creating var directory '/export/umesh/server/binaries/mysql-advanced-5.6.31/mysql-test/var'...
Installing system database...

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
#
# Bug#80873 - Function FLOOR(CEIL()) truncates bigint unsigned
#
select floor(ceil(12345678901234567890));
floor(ceil(12345678901234567890))
9223372036854775807 <-------- expected 12345678901234567890
main.80873                               [ pass ]
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.000 of 4 seconds executing testcases

Completed: All 1 tests were successful.

-- 5.5.50

[umshastr@hod03]/export/umesh/server/binaries/mysql-5.5.50/mysql-test: ./mtr 80873
Logging: ./mtr  80873
160329  6:50:01 [Note] /export/umesh/server/binaries/mysql-5.5.50/bin/mysqld (mysqld 5.5.50) starting as process 10179 ...
160329  6:50:01 [Note] Plugin 'FEDERATED' is disabled.
MySQL Version 5.5.50
Checking supported features...
 - SSL connections supported
Collecting tests...
Removing old var directory...
Creating var directory '/export/umesh/server/binaries/mysql-5.5.50/mysql-test/var'...
Installing system database...

==============================================================================

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
#
# Bug#80873 - Function FLOOR(CEIL()) truncates bigint unsigned
#
select floor(ceil(12345678901234567890));
floor(ceil(12345678901234567890))
9223372036854775807 <-------- expected 12345678901234567890
main.80873                               [ pass ]      1
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 0.001 of 5 seconds executing testcases

Completed: All 1 tests were successful.

-- 5.1.77

[umshastr@hod03]/export/umesh/server/binaries/mysql-5.1.77/mysql-test: ./mtr 80873
defined(@array) is deprecated at ./mtr line 449.
        (Maybe you should just omit the defined()?)
Logging: ./mtr  80873
160329  6:50:46 [Note] Plugin 'FEDERATED' is disabled.
MySQL Version 5.1.77
Checking supported features...
 - skipping ndbcluster
 - SSL connections supported
Collecting tests...
vardir: /export/umesh/server/binaries/mysql-5.1.77/mysql-test/var
Removing old var directory...
Creating var directory '/export/umesh/server/binaries/mysql-5.1.77/mysql-test/var'...
Installing system database...
Using server port 41179

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
#
# Bug#80873 - Function FLOOR(CEIL()) truncates bigint unsigned
#
select floor(ceil(12345678901234567890));
floor(ceil(12345678901234567890))
9223372036854775807 <-------- expected 12345678901234567890
main.80873                               [ pass ]      1
------------------------------------------------------------
The servers were restarted 0 times
Spent 0.001 of 1 seconds executing testcases

Completed: All 1 tests were successful.
[9 Apr 2016 16:10] Paul DuBois
Posted by developer:
 
Noted in 5.8.0 changelog.

FLOOR(CEIL()) truncated large BIGINT UNSIGNED arguments.