[MDEV-20285] Wrong result on INSERT..SELECT when converting from SIGNED to UNSIGNED Created: 2019-08-08  Updated: 2019-08-08  Resolved: 2019-08-08

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.3.18, 10.4.8

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

CREATE OR REPLACE TABLE t1 (a TINYINT UNSIGNED);
CREATE OR REPLACE TABLE t2 (a TINYINT);
INSERT INTO t1 VALUES (255);
INSERT IGNORE INTO t2 SELECT a FROM t1;
SELECT * FROM t2;

+------+
| a    |
+------+
|   -1 |
+------+

Notice, an out of range unsigned value of 255 was silently converted to its negative complement.

The expected result is 127 with a warning.


Generated at Thu Feb 08 08:58:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.