Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5(EOL), 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 12.1(EOL)
-
None
Description
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a BIGINT UNSIGNED);
|
INSERT INTO t1 VALUES (0x000000000000000000001);
|
SHOW WARNINGS;
|
SELECT * FROM t1;
|
returns:
+---------+------+--------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+--------------------------------------------+
|
| Warning | 1264 | Out of range value for column 'a' at row 1 |
|
+---------+------+--------------------------------------------+
|
+----------------------+
|
| a |
|
+----------------------+
|
| 18446744073709551615 |
|
+----------------------+
|
Storing 1 without a warning would be a more expected behavior.
Moreover, CAST returns 1, without warnings:
+-------------------------------------------+
|
| CAST(0x000000000000000000001 AS UNSIGNED) |
|
+-------------------------------------------+
|
| 1 |
|
+-------------------------------------------+
|
CAST looks better than a field assignment.