Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2.43, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL)
Description
From https://mariadb.com/kb/en/bigint-unsigned-with-least-or-greatest-unexpected-result/
MariaDB [test]> create table i (a bigint unsigned, b bigint unsigned);
|
Query OK, 0 rows affected (0.00 sec)
|
|
MariaDB [test]> insert into i values (18446744073709551615,0);
|
Query OK, 1 row affected (0.00 sec)
|
|
MariaDB [test]> select * from i;
|
Field 1: `a`
|
Catalog: `def`
|
Database: `test`
|
Table: `i`
|
Org_table: `i`
|
Type: LONGLONG
|
Collation: binary (63)
|
Length: 20
|
Max_length: 20
|
Decimals: 0
|
Flags: UNSIGNED NUM
|
|
Field 2: `b`
|
Catalog: `def`
|
Database: `test`
|
Table: `i`
|
Org_table: `i`
|
Type: LONGLONG
|
Collation: binary (63)
|
Length: 20
|
Max_length: 1
|
Decimals: 0
|
Flags: UNSIGNED NUM
|
|
|
+----------------------+------+
|
| a | b |
|
+----------------------+------+
|
| 18446744073709551615 | 0 |
|
+----------------------+------+
|
1 row in set (0.02 sec)
|
|
MariaDB [test]> SELECT LEAST(a,b), GREATEST(a,b), LEAST(a,cast(0 as unsigned integer)), GREATEST(a,cast(0 as unsigned integer)) from i;
|
Field 1: `LEAST(a,b)`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: LONGLONG
|
Collation: binary (63)
|
Length: 20
|
Max_length: 20
|
Decimals: 0
|
Flags: UNSIGNED BINARY NUM
|
|
Field 2: `GREATEST(a,b)`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: LONGLONG
|
Collation: binary (63)
|
Length: 20
|
Max_length: 1
|
Decimals: 0
|
Flags: UNSIGNED BINARY NUM
|
|
Field 3: `LEAST(a,cast(0 as unsigned integer))`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: LONGLONG
|
Collation: binary (63)
|
Length: 20
|
Max_length: 20
|
Decimals: 0
|
Flags: UNSIGNED BINARY NUM
|
|
Field 4: `GREATEST(a,cast(0 as unsigned integer))`
|
Catalog: `def`
|
Database: ``
|
Table: ``
|
Org_table: ``
|
Type: LONGLONG
|
Collation: binary (63)
|
Length: 20
|
Max_length: 1
|
Decimals: 0
|
Flags: UNSIGNED BINARY NUM
|
|
|
+----------------------+---------------+--------------------------------------+-----------------------------------------+
|
| LEAST(a,b) | GREATEST(a,b) | LEAST(a,cast(0 as unsigned integer)) | GREATEST(a,cast(0 as unsigned integer)) |
|
+----------------------+---------------+--------------------------------------+-----------------------------------------+
|
| 18446744073709551615 | 0 | 18446744073709551615 | 0 |
|
+----------------------+---------------+--------------------------------------+-----------------------------------------+
|
1 row in set (0.00 sec)
|