[MDEV-12853] Out-of-range errors when CAST('-1' AS UNSIGNED) Created: 2017-05-19  Updated: 2017-05-23  Resolved: 2017-05-23

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.2, 10.3
Fix Version/s: 10.3.1

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

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
Relates
relates to MDEV-12849 Out-of-range errors when casting hex-... Closed
relates to MDEV-12852 Out-of-range errors when CAST(1-2 AS ... Closed

 Description   

This problem is similar to MDEV-12852.
It's repeatable in 10.2, as well as in 10.1 with sql_mode=STRICT_ALL_TABLES set.

CREATE TABLE t1 AS SELECT CAST('-1' AS UNSIGNED);

ERROR 1264 (22003): Out of range value for column 'CAST('-1' AS UNSIGNED)' at row 1

CREATE TABLE t1 AS SELECT CAST('-1' AS UNSIGNED) LIMIT 0;
SHOW CREATE TABLE t1;

+-------+----------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                   |
+-------+----------------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `CAST('-1' AS UNSIGNED)` int(2) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+----------------------------------------------------------------------------------------------------------------+

Notice, int(2) is wrong. The expected type is BIGINT(20).



 Comments   
Comment by Alexander Barkov [ 2017-05-23 ]

Pushed into bb-10.2-ext

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