Bug #80110 Result type for "floor( -9223372036854775807 )" is NEWDECIMAL, LONGLONG expected
Submitted: 22 Jan 2016 4:47 Modified: 17 Feb 2021 13:18
Reporter: Su Dylan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.7.8, 5.6.28, 5.7.10 OS:Any
Assigned to: CPU Architecture:Any

[22 Jan 2016 4:47] Su Dylan
Description:
Output:
=====
mysql> select floor( -9223372036854775807 ), floor( 9223372036854775807 );
Field   1:  `floor( -9223372036854775807 )`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       NEWDECIMAL
Collation:  binary (63)
Length:     17
Max_length: 20
Decimals:   0
Flags:      NOT_NULL BINARY

Field   2:  `floor( 9223372036854775807 )`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       LONGLONG
Collation:  binary (63)
Length:     17
Max_length: 19
Decimals:   0
Flags:      NOT_NULL BINARY NUM

+-------------------------------+------------------------------+
| floor( -9223372036854775807 ) | floor( 9223372036854775807 ) |
+-------------------------------+------------------------------+
|          -9223372036854775807 |          9223372036854775807 |
+-------------------------------+------------------------------+
1 row in set (0.00 sec)

Problem:
=====
floor( -9223372036854775807 ) is expected to be with type LONGLONG.

How to repeat:
select floor( -9223372036854775807 ), floor( 9223372036854775807 );

Suggested fix:
floor( -9223372036854775807 ) is  with type LONGLONG.
[22 Jan 2016 6:49] MySQL Verification Team
Hello Su Dylan,

Thank you for the report.
Observed with 5.6.28 and 5.7.10 builds.

Thanks,
Umesh
[17 Feb 2021 13:18] Erlend Dahl
[5 Oct 2020 5:45] Tor Didriksen

Fixed in current 8.0

mysql> select floor( -9223372036854775807 ), floor( 9223372036854775807 );
Field   1:  `floor( -9223372036854775807 )`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       LONGLONG
Collation:  binary (63)
Length:     21
Max_length: 20
Decimals:   0
Flags:      NOT_NULL BINARY NUM

Field   2:  `floor( 9223372036854775807 )`
Catalog:    `def`
Database:   ``
Table:      ``
Org_table:  ``
Type:       LONGLONG
Collation:  binary (63)
Length:     21
Max_length: 19
Decimals:   0
Flags:      NOT_NULL BINARY NUM

+-------------------------------+------------------------------+
| floor( -9223372036854775807 ) | floor( 9223372036854775807 ) |
+-------------------------------+------------------------------+
|          -9223372036854775807 |          9223372036854775807 |
+-------------------------------+------------------------------+
1 row in set (0.00 sec)