Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL)
-
None
Description
$ mysql-tmp --column-type-info test
|
...
|
mysql> SELECT 18446744073709551615 AS c1, name_const('a',18446744073709551615) AS c2;
|
...
|
Field 1: `c1`
|
Type: LONGLONG
|
Flags: NOT_NULL UNSIGNED BINARY NUM
|
...
|
Field 2: `c2`
|
Type: LONGLONG
|
Flags: BINARY NUM
|
...
|
+----------------------+----------------------+
|
| c1 | c2 |
|
+----------------------+----------------------+
|
| 18446744073709551615 | 18446744073709551615 |
|
+----------------------+----------------------
|
Notice, metadata says LONGLONG UNSIGNED for c1 but LONGLONG SIGNED for c2, but return values are both unsigned.
Another example of incorrect behaviour:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 AS SELECT 18446744073709551615 AS c1, name_const('a',18446744073709551615) AS c2; |
SHOW WARNINGS;
|
SHOW CREATE TABLE t1; |
The above script returns
+---------+------+---------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+---------------------------------------------+
|
| Warning | 1264 | Out of range value for column 'c2' at row 1 |
|
+---------+------+---------------------------------------------+
|
1 row in set (0.00 sec)
|
 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+--------------------------------------------------------------------------------------------------------------------------------------------+
|
| t1 | CREATE TABLE `t1` (
|
`c1` bigint(20) unsigned NOT NULL DEFAULT '0',
|
`c2` bigint(20) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+--------------------------------------------------------------------------------------------------------------------------------------------+
|
The expected result is to have unsigned flag in both fields.