diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-04-30 15:51:49 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-04-30 15:51:49 +0400 |
commit | 8c8bee0a5635d7f8197a148f267c04c1452b47fc (patch) | |
tree | ec46c8a00857d104ab87a14649d61128344b5977 /mysql-test | |
parent | 447b8ba1645435cb7d538a6f1b644cad113f4835 (diff) | |
download | mariadb-git-8c8bee0a5635d7f8197a148f267c04c1452b47fc.tar.gz |
MDEV-10307 CAST(11068046444225730969 AS SIGNED) does not return a warning
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/main/cast.result | 19 | ||||
-rw-r--r-- | mysql-test/main/cast.test | 6 | ||||
-rw-r--r-- | mysql-test/main/default.result | 2 |
3 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/main/cast.result b/mysql-test/main/cast.result index ca314573581..1dc6bbbf9e7 100644 --- a/mysql-test/main/cast.result +++ b/mysql-test/main/cast.result @@ -9,6 +9,7 @@ CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER) -1 Warnings: Note 1105 Cast to unsigned converted negative integer to it's positive complement +Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement select CAST('10 ' as unsigned integer); CAST('10 ' as unsigned integer) 10 @@ -29,6 +30,8 @@ Note 1105 Cast to unsigned converted negative integer to it's positive complemen select ~5, cast(~5 as signed); ~5 cast(~5 as signed) 18446744073709551610 -6 +Warnings: +Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement explain extended select ~5, cast(~5 as signed); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used @@ -37,6 +40,8 @@ Note 1003 select ~5 AS `~5`,cast(~5 as signed) AS `cast(~5 as signed)` select cast(18446744073709551615 as signed); cast(18446744073709551615 as signed) -1 +Warnings: +Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement select cast(5 as unsigned) -6.0; cast(5 as unsigned) -6.0 -1.0 @@ -212,12 +217,16 @@ CAST(0xb3 as signed) select CAST(0x8fffffffffffffff as signed); CAST(0x8fffffffffffffff as signed) -8070450532247928833 +Warnings: +Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement select CAST(0xffffffffffffffff as unsigned); CAST(0xffffffffffffffff as unsigned) 18446744073709551615 select CAST(0xfffffffffffffffe as signed); CAST(0xfffffffffffffffe as signed) -2 +Warnings: +Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement select cast('-10a' as signed integer); cast('-10a' as signed integer) -10 @@ -554,6 +563,8 @@ cast(18446744073709551615 as unsigned) select cast(18446744073709551615 as signed); cast(18446744073709551615 as signed) -1 +Warnings: +Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement select cast('18446744073709551615' as unsigned); cast('18446744073709551615' as unsigned) 18446744073709551615 @@ -1277,3 +1288,11 @@ END; $$ ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30' SET sql_mode=DEFAULT; +# +# MDEV-10307 CAST(11068046444225730969 AS SIGNED) does not return a warning +# +SELECT CAST(11068046444225730969 AS SIGNED); +CAST(11068046444225730969 AS SIGNED) +-7378697629483820647 +Warnings: +Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement diff --git a/mysql-test/main/cast.test b/mysql-test/main/cast.test index b514dbb5b2d..f48d6d9f95f 100644 --- a/mysql-test/main/cast.test +++ b/mysql-test/main/cast.test @@ -724,3 +724,9 @@ $$ DELIMITER ;$$ SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-10307 CAST(11068046444225730969 AS SIGNED) does not return a warning +--echo # + +SELECT CAST(11068046444225730969 AS SIGNED); diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result index 73417d0d64e..c214e529d72 100644 --- a/mysql-test/main/default.result +++ b/mysql-test/main/default.result @@ -2217,6 +2217,8 @@ t1 CREATE TABLE `t1` ( `b` bigint(20) DEFAULT (cast(`a` as signed)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (0xFFFFFFFFFFFFFFFF); +Warnings: +Note 1105 Cast to signed converted positive out-of-range integer to it's negative complement SELECT * FROM t1; a b 18446744073709551615 -1 |