summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-09-17 11:05:07 +0400
committerAlexander Barkov <bar@mariadb.org>2015-09-17 11:05:07 +0400
commitd9b25ae3db8584bde809c0ab3230cbe151fa489b (patch)
treecb0ae8c91d4f1bcd614c3c1b2d7847f3ef7a130f
parentc69cf93bfb3a221d9106f3695aa16e11f7e8b7fb (diff)
downloadmariadb-git-d9b25ae3db8584bde809c0ab3230cbe151fa489b.tar.gz
MDEV-8466 CAST works differently for DECIMAL/INT vs DOUBLE for empty strings
MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
-rw-r--r--mysql-test/r/bug13633383.result61
-rw-r--r--mysql-test/r/cast.result2
-rw-r--r--mysql-test/r/ctype_cp1251.result6
-rw-r--r--mysql-test/r/ctype_many.result1
-rw-r--r--mysql-test/r/ctype_ucs.result2
-rw-r--r--mysql-test/r/ctype_utf16.result4
-rw-r--r--mysql-test/r/ctype_utf16le.result4
-rw-r--r--mysql-test/r/ctype_utf32.result4
-rw-r--r--mysql-test/r/ctype_utf8.result6
-rw-r--r--mysql-test/r/func_compress.result3
-rw-r--r--mysql-test/r/func_math.result5
-rw-r--r--mysql-test/r/func_str.result2
-rw-r--r--mysql-test/r/func_time.result1
-rw-r--r--mysql-test/r/gis-debug.result2
-rw-r--r--mysql-test/r/gis-precise.result2
-rw-r--r--mysql-test/r/insert.result32
-rw-r--r--mysql-test/r/loaddata.result24
-rw-r--r--mysql-test/r/sp-error.result24
-rw-r--r--mysql-test/r/sp.result4
-rw-r--r--mysql-test/r/strict.result16
-rw-r--r--mysql-test/r/subselect.result10
-rw-r--r--mysql-test/r/subselect_no_exists_to_in.result10
-rw-r--r--mysql-test/r/subselect_no_mat.result10
-rw-r--r--mysql-test/r/subselect_no_opts.result10
-rw-r--r--mysql-test/r/subselect_no_scache.result10
-rw-r--r--mysql-test/r/subselect_no_semijoin.result10
-rw-r--r--mysql-test/r/trigger.result7
-rw-r--r--mysql-test/r/type_decimal.result9
-rw-r--r--mysql-test/r/type_float.result2
-rw-r--r--mysql-test/r/type_num.result1222
-rw-r--r--mysql-test/r/type_varchar.result2
-rw-r--r--mysql-test/r/varbinary.result2
-rw-r--r--mysql-test/r/view.result11
-rw-r--r--mysql-test/r/xml.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result9
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result9
-rw-r--r--mysql-test/suite/federated/federatedx.result5
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result14
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result14
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result14
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result2
-rw-r--r--mysql-test/suite/maria/maria2.result10
-rw-r--r--mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_rewrt_db.result6
-rw-r--r--mysql-test/t/ctype_ucs.test2
-rw-r--r--mysql-test/t/sp-error.test4
-rw-r--r--mysql-test/t/strict.test12
-rw-r--r--mysql-test/t/type_num.test683
-rw-r--r--sql/field.cc435
-rw-r--r--sql/field.h262
-rw-r--r--sql/item.cc69
-rw-r--r--sql/item.h7
-rw-r--r--sql/item_func.cc25
-rw-r--r--sql/item_strfunc.cc6
-rw-r--r--sql/my_decimal.cc21
-rw-r--r--sql/my_decimal.h14
-rw-r--r--sql/set_var.h2
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_decimal.result9
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/type_varchar.result2
-rw-r--r--strings/ctype-simple.c5
60 files changed, 2779 insertions, 390 deletions
diff --git a/mysql-test/r/bug13633383.result b/mysql-test/r/bug13633383.result
index 3b533f89df2..a6f5bab5260 100644
--- a/mysql-test/r/bug13633383.result
+++ b/mysql-test/r/bug13633383.result
@@ -49,5 +49,66 @@ col435
0.00000000000000000
0.00000000000000000
0.00000000000000000
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00k\xBF\xC0\x00\x00\x00\x00\x00j\xF8@'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x006\x0E\xFD\xB9PVh,;b\xC2\xBA\xF6$\xEE\xB0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xC0\xAE\xDB\xC0'
+Warning 1292 Truncated incorrect DOUBLE value: '\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00j\xF8@\x00\x00\x00\x00\x00\x00\x00\x00'
set session sort_buffer_size= default;
DROP TABLE t1, t2, t3;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 5ea8f2b6d8c..4c9f257fdf2 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -13,7 +13,7 @@ select CAST('10 ' as unsigned integer);
CAST('10 ' as unsigned integer)
10
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1;
cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1
18446744073709551611 18446744073709551611
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index 92678f200bd..c69a56b3b9c 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -3345,12 +3345,18 @@ INSERT INTO t1 VALUES (' 1'),('`1');
SELECT * FROM t1 WHERE a IN (1,2,3);
a
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
a
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1';
a
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result
index f0f98b15e11..59443a3a2d5 100644
--- a/mysql-test/r/ctype_many.result
+++ b/mysql-test/r/ctype_many.result
@@ -1694,6 +1694,7 @@ DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1)
AS BINARY(0)) USING utf8);
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'Zpq'
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect BINARY(0) value: '1.'
#
# End of 5.1 tests
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 4da9e95a806..803ca9a048b 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -5340,7 +5340,7 @@ Warning 1292 Truncated incorrect INTEGER value: ''
CREATE TABLE t1 (a DECIMAL(2,0));
SET sql_mode='strict_all_tables';
INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2));
-ERROR 22007: Incorrect decimal value: '9e99999999' for column 'a' at row 1
+ERROR 22003: Out of range value for column 'a' at row 1
SET sql_mode=DEFAULT;
INSERT INTO t1 VALUES (CONVERT('aaa' USING ucs2));
Warnings:
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index bfcd65044d4..77941ab4906 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -1254,6 +1254,8 @@ insert into t1 values ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
select * from t1;
a
-123410
@@ -1262,6 +1264,8 @@ a
drop table t1;
create table t1 (a int);
insert into t1 values ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
insert into t1 values ('1 x');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
diff --git a/mysql-test/r/ctype_utf16le.result b/mysql-test/r/ctype_utf16le.result
index f11d1986b26..a2d3ffb793f 100644
--- a/mysql-test/r/ctype_utf16le.result
+++ b/mysql-test/r/ctype_utf16le.result
@@ -1474,6 +1474,8 @@ INSERT INTO t1 VALUES ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('-1234.1e2 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('123');
INSERT INTO t1 VALUES ('-124');
INSERT INTO t1 VALUES ('+125');
@@ -1520,6 +1522,8 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('1 x');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 5840d23f3e0..16e045d0fbb 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -1252,6 +1252,8 @@ insert into t1 values ('-1234.1e2xxxx');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
select * from t1;
a
-123410
@@ -1260,6 +1262,8 @@ a
drop table t1;
create table t1 (a int);
insert into t1 values ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
insert into t1 values ('1 x');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index b1325ffe9ed..3300def3964 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -10174,12 +10174,18 @@ INSERT INTO t1 VALUES ('1e1'),('1ë1');
SELECT * FROM t1 WHERE a IN (1,2);
a
1ë1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
a
1ë1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1';
a
1ë1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 4763d878cc6..e9c8193685b 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -73,6 +73,9 @@ set @@global.max_allowed_packet=1048576*100;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: XXX
+Warning 1292 Truncated incorrect DOUBLE value: XXX
set @@global.max_allowed_packet=default;
create table t1(a blob);
insert into t1 values(NULL), (compress('a'));
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 73e486972ab..c49e55d503a 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -476,8 +476,13 @@ CREATE TABLE t1(f1 LONGTEXT) engine=myisam;
INSERT INTO t1 VALUES ('a');
SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
DROP TABLE t1;
End of 5.0 tests
SELECT 1e308 + 1e308;
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index c37fa7a654a..d392da84ea7 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2893,6 +2893,8 @@ NULL
SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)));
((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)))
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
((0xf3) * (rpad(1.0,2048,1)) << (0xcc))
0
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index bbdbfe0c549..b829bb6ead7 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1714,6 +1714,7 @@ min(timestampadd(month, 1>'', from_days('%Z')))
NULL
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '%Z'
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Incorrect datetime value: '0000-00-00'
create table t1(a time);
insert into t1 values ('00:00:00'),('00:01:00');
diff --git a/mysql-test/r/gis-debug.result b/mysql-test/r/gis-debug.result
index 8593f434c2b..5e8b4747f6d 100644
--- a/mysql-test/r/gis-debug.result
+++ b/mysql-test/r/gis-debug.result
@@ -267,6 +267,8 @@ POLYGON
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),
diff --git a/mysql-test/r/gis-precise.result b/mysql-test/r/gis-precise.result
index 73aac9dbe05..3824ba6afbb 100644
--- a/mysql-test/r/gis-precise.result
+++ b/mysql-test/r/gis-precise.result
@@ -754,6 +754,8 @@ POLYGON
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 82f3977e231..b5546202a6e 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -92,14 +92,14 @@ create table t1(number int auto_increment primary key, original_value varchar(50
set @value= "aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
-Warning 1265 Data truncated for column 'f_double' at row 1
-Warning 1265 Data truncated for column 'f_float' at row 1
-Warning 1265 Data truncated for column 'f_double_7_2' at row 1
-Warning 1265 Data truncated for column 'f_float_4_3' at row 1
-Warning 1265 Data truncated for column 'f_double_u' at row 1
-Warning 1265 Data truncated for column 'f_float_u' at row 1
-Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
-Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_double' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_float' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_double_7_2' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_float_4_3' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_double_u' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_float_u' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_double_15_1_u' at row 1
+Warning 1366 Incorrect double value: 'aa' for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 1
original_value aa
@@ -136,14 +136,14 @@ f_float_3_1_u 1.0
set @value= "aa1";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
-Warning 1265 Data truncated for column 'f_double' at row 1
-Warning 1265 Data truncated for column 'f_float' at row 1
-Warning 1265 Data truncated for column 'f_double_7_2' at row 1
-Warning 1265 Data truncated for column 'f_float_4_3' at row 1
-Warning 1265 Data truncated for column 'f_double_u' at row 1
-Warning 1265 Data truncated for column 'f_float_u' at row 1
-Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
-Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_double' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_float' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_double_7_2' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_float_4_3' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_double_u' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_float_u' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_double_15_1_u' at row 1
+Warning 1366 Incorrect double value: 'aa1' for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 3
original_value aa1
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 2d67d24bedd..8cd3b0a7ac8 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -43,8 +43,11 @@ drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
+Note 1265 Data truncated for column 'a' at row 4
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from t1;
@@ -57,6 +60,9 @@ a b
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: '
' for column 'a' at row 4
Warning 1261 Row 4 doesn't contain data for all columns
@@ -73,6 +79,8 @@ insert into t1 values(0);
select * from t1;
id
0
+Warnings:
+Note 1265 Data truncated for column 'id' at row 1
select * from t1;
id
0
@@ -180,6 +188,13 @@ NULL 10 10
NULL 15 15
truncate table t1;
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'b' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'b' at row 2
+Note 1265 Data truncated for column 'a' at row 3
+Note 1265 Data truncated for column 'b' at row 3
select * from t1;
a b c
1 2 Wow
@@ -187,6 +202,13 @@ a b c
5 6 Wow
truncate table t1;
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'b' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'b' at row 2
+Note 1265 Data truncated for column 'a' at row 3
+Note 1265 Data truncated for column 'b' at row 3
select * from t1;
a b c
1 2 1+2+123+2+NIL
@@ -234,7 +256,9 @@ f1
2
delete from t1;
Warnings:
+Note 1265 Data truncated for column 'f1' at row 1
Warning 1261 Row 1 doesn't contain data for all columns
+Note 1265 Data truncated for column 'f1' at row 2
Warning 1261 Row 2 doesn't contain data for all columns
select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
f1
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 4373925b8ac..1f38e3888a0 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1758,7 +1758,7 @@ CAST('10 ' as unsigned integer)
CAST('10 ' as unsigned integer)
10
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE p2;
@@ -1767,7 +1767,7 @@ DROP PROCEDURE p2;
CREATE PROCEDURE p1()
BEGIN
DECLARE c INT DEFAULT 0;
-DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p2();
CALL p3();
CALL p4();
@@ -1797,7 +1797,7 @@ END|
CREATE PROCEDURE P6()
BEGIN
DECLARE c INT DEFAULT 0;
-DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p5();
SELECT c;
END|
@@ -1821,7 +1821,7 @@ CALL p6();
CAST('10 ' as unsigned integer)
10
Level Code Message
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
c
1
DROP PROCEDURE p1;
@@ -1982,9 +1982,9 @@ Level Code Message
Warning 1264 Out of range value for column 'x' at row 1
Warning 1264 Out of range value for column 'y' at row 1
Warning 1264 Out of range value for column 'z' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '111111 '
+Note 1292 Truncated incorrect INTEGER value: '111111 '
Warning 1264 Out of range value for column 'a' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '222222 '
+Note 1292 Truncated incorrect INTEGER value: '222222 '
Warning 1264 Out of range value for column 'b' at row 1
Error 1048 Column 'c' cannot be null
@@ -2744,14 +2744,14 @@ END|
CALL p6()|
Level Code Message
-Warning 1292 Truncated incorrect INTEGER value: '1 '
-Warning 1292 Truncated incorrect INTEGER value: '1999999 '
+Note 1292 Truncated incorrect INTEGER value: '1 '
+Note 1292 Truncated incorrect INTEGER value: '1999999 '
Warning 1264 Out of range value for column 'a' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '2 '
-Warning 1292 Truncated incorrect INTEGER value: '2999999 '
+Note 1292 Truncated incorrect INTEGER value: '2 '
+Note 1292 Truncated incorrect INTEGER value: '2999999 '
Warning 1264 Out of range value for column 'b' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '3 '
-Warning 1292 Truncated incorrect INTEGER value: '3999999 '
+Note 1292 Truncated incorrect INTEGER value: '3 '
+Note 1292 Truncated incorrect INTEGER value: '3999999 '
Warning 1264 Out of range value for column 'c' at row 1
Msg
Handler for 1292
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index fe81c96e811..51c1b1924d1 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7102,7 +7102,7 @@ CAST('10 ' as UNSIGNED INTEGER)
1
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
@@ -7128,7 +7128,7 @@ CAST('10 ' as UNSIGNED INTEGER)
2
2
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index caec188ce74..66a4225a710 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -778,7 +778,7 @@ ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E+1');
ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E');
-ERROR 22007: Incorrect decimal value: '-100E' for column 'col1' at row 1
+ERROR 01000: Data truncated for column 'col1' at row 1
UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
ERROR 22003: Out of range value for column 'col1' at row 6
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
@@ -790,10 +790,10 @@ ERROR 22007: Incorrect decimal value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
-ERROR 22007: Incorrect decimal value: '1a' for column 'col1' at row 1
+ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
Warnings:
-Note 1265 Data truncated for column 'col1' at row 1
+Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 values (1/0);
Warnings:
Warning 1365 Division by 0
@@ -853,9 +853,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 01000: Data truncated for column 'col1' at row 1
+ERROR 22007: Incorrect double value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 01000: Data truncated for column 'col1' at row 1
+ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -903,9 +903,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
-ERROR 01000: Data truncated for column 'col1' at row 1
+ERROR 22007: Incorrect double value: '' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
-ERROR 01000: Data truncated for column 'col1' at row 1
+ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
@@ -1125,6 +1125,8 @@ ERROR 22007: Truncated incorrect INTEGER value: '10a'
insert into t1 (col2) values (cast('10' as unsigned integer));
insert into t1 (col2) values (cast('10' as signed integer));
insert into t1 (col2) values (10E+0 + '0 ');
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '0 '
select * from t1;
col1 col2
NULL 10
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 6b3663489b0..689edfa6dab 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -6312,12 +6312,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index b6984cac86f..195f377e7ff 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -6312,12 +6312,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index a0922b95e35..26794b452cc 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -6307,12 +6307,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 9b38ab43d26..9a43e64554e 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -6303,12 +6303,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index 672999922fa..0a88e26bd2d 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -6318,12 +6318,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 5247de1144e..142f9f679bf 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -6303,12 +6303,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
SELECT 1 FROM t1 WHERE a =
(SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b
);
1
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
+Warning 1292 Truncated incorrect DOUBLE value: 'a'
+Warning 1292 Truncated incorrect DOUBLE value: 'b'
DROP TABLE t1, t2;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index e71090b8528..9dfa5897af1 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -415,6 +415,13 @@ i j k @b
15 NULL 15 Fired
set @b:="";
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
+Warnings:
+Note 1265 Data truncated for column 'i' at row 1
+Note 1265 Data truncated for column 'j' at row 1
+Note 1265 Data truncated for column 'i' at row 2
+Note 1265 Data truncated for column 'j' at row 2
+Note 1265 Data truncated for column 'i' at row 3
+Note 1265 Data truncated for column 'j' at row 3
select *, @b from t1;
i j k @b
10 NULL 10 Fired
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index cde8816dee4..85ea43752a5 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -181,7 +181,7 @@ Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -246,7 +246,7 @@ Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -305,7 +305,7 @@ Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -358,6 +358,9 @@ insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings:
Note 1265 Data truncated for column 'a' at row 3
insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 ");
+Warnings:
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 21734b30c8c..e7267f012ae 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -458,7 +458,7 @@ Warnings:
Warning 1265 Data truncated for column 'f' at row 1
INSERT INTO t1 VALUES ('.');
Warnings:
-Warning 1265 Data truncated for column 'f' at row 1
+Warning 1366 Incorrect double value: '.' for column 'f' at row 1
SELECT * FROM t1 ORDER BY f;
f
0
diff --git a/mysql-test/r/type_num.result b/mysql-test/r/type_num.result
new file mode 100644
index 00000000000..cbac7b6f445
--- /dev/null
+++ b/mysql-test/r/type_num.result
@@ -0,0 +1,1222 @@
+#
+# Start of 10.0 tests
+#
+#
+# MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
+#
+SET sql_mode='STRICT_ALL_TABLES';
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1 ');
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect double value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect double value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect integer value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('');
+ERROR 22007: Incorrect decimal value: '' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('x');
+ERROR 22007: Incorrect decimal value: 'x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES (' x');
+ERROR 22007: Incorrect decimal value: ' x' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect double value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect double value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('.');
+ERROR 22007: Incorrect decimal value: '.' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect double value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect double value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('-');
+ERROR 22007: Incorrect decimal value: '-' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect double value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect double value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('+');
+ERROR 22007: Incorrect decimal value: '+' for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1e');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1e+');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1E-');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1Ex');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1e+x');
+ERROR 01000: Data truncated for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1e1000');
+ERROR 22003: Out of range value for column 'a' at row 1
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
+CREATE TABLE t1 (
+f4 FLOAT,
+f8 DOUBLE,
+i1 TINYINT,
+i2 SMALLINT,
+i4 INT,
+i8 BIGINT,
+d DECIMAL
+);
+INSERT INTO t1 VALUES ('1 ','1 ','1 ','1 ','1 ','1 ','1 ');
+Warnings:
+Note 1265 Data truncated for column 'f4' at row 1
+Note 1265 Data truncated for column 'f8' at row 1
+Note 1265 Data truncated for column 'i1' at row 1
+Note 1265 Data truncated for column 'i2' at row 1
+Note 1265 Data truncated for column 'i4' at row 1
+Note 1265 Data truncated for column 'i8' at row 1
+Note 1265 Data truncated for column 'd' at row 1
+INSERT INTO t1 VALUES ('','','','','','','');
+Warnings:
+Warning 1366 Incorrect double value: '' for column 'f4' at row 1
+Warning 1366 Incorrect double value: '' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: '' for column 'i1' at row 1
+Warning 1366 Incorrect integer value: '' for column 'i2' at row 1
+Warning 1366 Incorrect integer value: '' for column 'i4' at row 1
+Warning 1366 Incorrect integer value: '' for column 'i8' at row 1
+Warning 1366 Incorrect decimal value: '' for column 'd' at row 1
+INSERT INTO t1 VALUES ('x','x','x','x','x','x','x');
+Warnings:
+Warning 1366 Incorrect double value: 'x' for column 'f4' at row 1
+Warning 1366 Incorrect double value: 'x' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: 'x' for column 'i1' at row 1
+Warning 1366 Incorrect integer value: 'x' for column 'i2' at row 1
+Warning 1366 Incorrect integer value: 'x' for column 'i4' at row 1
+Warning 1366 Incorrect integer value: 'x' for column 'i8' at row 1
+Warning 1366 Incorrect decimal value: 'x' for column 'd' at row 1
+INSERT INTO t1 VALUES (' x',' x',' x',' x',' x',' x',' x');
+Warnings:
+Warning 1366 Incorrect double value: ' x' for column 'f4' at row 1
+Warning 1366 Incorrect double value: ' x' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: ' x' for column 'i1' at row 1
+Warning 1366 Incorrect integer value: ' x' for column 'i2' at row 1
+Warning 1366 Incorrect integer value: ' x' for column 'i4' at row 1
+Warning 1366 Incorrect integer value: ' x' for column 'i8' at row 1
+Warning 1366 Incorrect decimal value: ' x' for column 'd' at row 1
+INSERT INTO t1 VALUES ('.','.','.','.','.','.','.');
+Warnings:
+Warning 1366 Incorrect double value: '.' for column 'f4' at row 1
+Warning 1366 Incorrect double value: '.' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: '.' for column 'i1' at row 1
+Warning 1366 Incorrect integer value: '.' for column 'i2' at row 1
+Warning 1366 Incorrect integer value: '.' for column 'i4' at row 1
+Warning 1366 Incorrect integer value: '.' for column 'i8' at row 1
+Warning 1366 Incorrect decimal value: '.' for column 'd' at row 1
+INSERT INTO t1 VALUES ('-','-','-','-','-','-','-');
+Warnings:
+Warning 1366 Incorrect double value: '-' for column 'f4' at row 1
+Warning 1366 Incorrect double value: '-' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: '-' for column 'i1' at row 1
+Warning 1366 Incorrect integer value: '-' for column 'i2' at row 1
+Warning 1366 Incorrect integer value: '-' for column 'i4' at row 1
+Warning 1366 Incorrect integer value: '-' for column 'i8' at row 1
+Warning 1366 Incorrect decimal value: '-' for column 'd' at row 1
+INSERT INTO t1 VALUES ('+','+','+','+','+','+','+');
+Warnings:
+Warning 1366 Incorrect double value: '+' for column 'f4' at row 1
+Warning 1366 Incorrect double value: '+' for column 'f8' at row 1
+Warning 1366 Incorrect integer value: '+' for column 'i1' at row 1
+Warning 1366 Incorrect integer value: '+' for column 'i2' at row 1
+Warning 1366 Incorrect integer value: '+' for column 'i4' at row 1
+Warning 1366 Incorrect integer value: '+' for column 'i8' at row 1
+Warning 1366 Incorrect decimal value: '+' for column 'd' at row 1
+INSERT INTO t1 VALUES ('1x','1x','1x','1x','1x','1x','1x');
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
+Warning 1265 Data truncated for column 'f8' at row 1
+Warning 1265 Data truncated for column 'i1' at row 1
+Warning 1265 Data truncated for column 'i2' at row 1
+Warning 1265 Data truncated for column 'i4' at row 1
+Warning 1265 Data truncated for column 'i8' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+INSERT INTO t1 VALUES ('1e','1e','1e','1e','1e','1e','1e');
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
+Warning 1265 Data truncated for column 'f8' at row 1
+Warning 1265 Data truncated for column 'i1' at row 1
+Warning 1265 Data truncated for column 'i2' at row 1
+Warning 1265 Data truncated for column 'i4' at row 1
+Warning 1265 Data truncated for column 'i8' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+INSERT INTO t1 VALUES ('1e-','1e-','1e-','1e-','1e-','1e-','1e-');
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
+Warning 1265 Data truncated for column 'f8' at row 1
+Warning 1265 Data truncated for column 'i1' at row 1
+Warning 1265 Data truncated for column 'i2' at row 1
+Warning 1265 Data truncated for column 'i4' at row 1
+Warning 1265 Data truncated for column 'i8' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+INSERT INTO t1 VALUES ('1E+','1E+','1E+','1E+','1E+','1E+','1E+');
+Warnings:
+Warning 1265 Data truncated for column 'f4' at row 1
+Warning 1265 Data truncated for column 'f8' at row 1
+Warning 1265 Data truncated for column 'i1' at row 1
+Warning 1265 Data truncated for column 'i2' at row 1
+Warning 1265 Data truncated for column 'i4' at row 1
+Warning 1265 Data truncated for column 'i8' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+INSERT INTO t1 VALUES ('1e1000','1e1000','1e1000','1e1000','1e1000','1e1000','1e1000');
+Warnings:
+Warning 1264 Out of range value for column 'f4' at row 1
+Warning 1264 Out of range value for column 'f4' at row 1
+Warning 1264 Out of range value for column 'f8' at row 1
+Warning 1264 Out of range value for column 'i1' at row 1
+Warning 1264 Out of range value for column 'i2' at row 1
+Warning 1264 Out of range value for column 'i4' at row 1
+Warning 1264 Out of range value for column 'i8' at row 1
+Warning 1264 Out of range value for column 'd' at row 1
+DELETE FROM t1;
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
+INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
+INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
+INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
+INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
+INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
+INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
+INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
+INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
+INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
+SELECT COUNT(*) FROM t1 WHERE f4='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE f8='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE i1='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE i2='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE i4='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE i8='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE d='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 WHERE f4='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE f8='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE i1='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE i2='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE i4='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE i8='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE d='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 WHERE f4='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE f8='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE i1='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE i2='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE i4='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE i8='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE d='x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT COUNT(*) FROM t1 WHERE f4=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE f8=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE i1=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE i2=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE i4=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE i8=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE d=' x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT COUNT(*) FROM t1 WHERE f4='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE f8='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE i1='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE i2='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE i4='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE i8='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE d='.';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT COUNT(*) FROM t1 WHERE f4='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE f8='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE i1='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE i2='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE i4='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE i8='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE d='-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT COUNT(*) FROM t1 WHERE f4='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE f8='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE i1='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE i2='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE i4='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE i8='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE d='+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT COUNT(*) FROM t1 WHERE f4='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE f8='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE i1='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE i2='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE i4='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE i8='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE d='1x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT COUNT(*) FROM t1 WHERE f4='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE f8='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE i1='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE i2='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE i4='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE i8='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE d='1e';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT COUNT(*) FROM t1 WHERE f4='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE f8='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE i1='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE i2='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE i4='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE i8='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE d='1e+';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+'
+SELECT COUNT(*) FROM t1 WHERE f4='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE f8='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE i1='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE i2='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE i4='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE i8='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE d='1E-';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1E-'
+SELECT COUNT(*) FROM t1 WHERE f4='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE f8='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE i1='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE i2='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE i4='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE i8='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE d='1Ex';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1Ex'
+SELECT COUNT(*) FROM t1 WHERE f4='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE f8='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE i1='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE i2='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE i4='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE i8='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE d='1e+x';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e+x'
+SELECT COUNT(*) FROM t1 WHERE f4='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE f8='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE i1='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE i2='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE i4='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE i8='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+SELECT COUNT(*) FROM t1 WHERE d='1e1000';
+COUNT(*)
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1e1000'
+ALTER TABLE t1
+ADD KEY f4(f4),
+ADD KEY f8(f8),
+ADD KEY i1(i1),
+ADD KEY i2(i2),
+ADD KEY i4(i4),
+ADD KEY i8(i8),
+ADD KEY d(d);
+SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='1 ';
+COUNT(*)
+2
+Warnings:
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='1 ';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='';
+COUNT(*)
+2
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='';
+COUNT(*)
+2
+DROP TABLE t1;
+SELECT
+CAST('1 ' AS SIGNED),
+CAST('1 ' AS UNSIGNED),
+CAST('1 ' AS DECIMAL),
+CAST('1 ' AS DOUBLE);
+CAST('1 ' AS SIGNED) CAST('1 ' AS UNSIGNED) CAST('1 ' AS DECIMAL) CAST('1 ' AS DOUBLE)
+1 1 1 1
+Warnings:
+Note 1292 Truncated incorrect INTEGER value: '1 '
+Note 1292 Truncated incorrect INTEGER value: '1 '
+Note 1292 Truncated incorrect DECIMAL value: '1 '
+Note 1292 Truncated incorrect DOUBLE value: '1 '
+SELECT
+CAST('' AS SIGNED),
+CAST('' AS UNSIGNED),
+CAST('' AS DECIMAL),
+CAST('' AS DOUBLE);
+CAST('' AS SIGNED) CAST('' AS UNSIGNED) CAST('' AS DECIMAL) CAST('' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
+Warning 1292 Truncated incorrect INTEGER value: ''
+Warning 1292 Truncated incorrect DECIMAL value: ''
+Warning 1292 Truncated incorrect DOUBLE value: ''
+SELECT
+CAST('x' AS SIGNED),
+CAST('x' AS UNSIGNED),
+CAST('x' AS DECIMAL),
+CAST('x' AS DOUBLE);
+CAST('x' AS SIGNED) CAST('x' AS UNSIGNED) CAST('x' AS DECIMAL) CAST('x' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+Warning 1292 Truncated incorrect INTEGER value: 'x'
+Warning 1292 Truncated incorrect DECIMAL value: 'x'
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+SELECT
+CAST(' x' AS SIGNED),
+CAST(' x' AS UNSIGNED),
+CAST(' x' AS DECIMAL),
+CAST(' x' AS DOUBLE);
+CAST(' x' AS SIGNED) CAST(' x' AS UNSIGNED) CAST(' x' AS DECIMAL) CAST(' x' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ' x'
+Warning 1292 Truncated incorrect INTEGER value: ' x'
+Warning 1292 Truncated incorrect DECIMAL value: ' x'
+Warning 1292 Truncated incorrect DOUBLE value: ' x'
+SELECT
+CAST('.' AS SIGNED),
+CAST('.' AS UNSIGNED),
+CAST('.' AS DECIMAL),
+CAST('.' AS DOUBLE);
+CAST('.' AS SIGNED) CAST('.' AS UNSIGNED) CAST('.' AS DECIMAL) CAST('.' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '.'
+Warning 1292 Truncated incorrect INTEGER value: '.'
+Warning 1292 Truncated incorrect DECIMAL value: '.'
+Warning 1292 Truncated incorrect DOUBLE value: '.'
+SELECT
+CAST('-' AS SIGNED),
+CAST('-' AS UNSIGNED),
+CAST('-' AS DECIMAL),
+CAST('-' AS DOUBLE);
+CAST('-' AS SIGNED) CAST('-' AS UNSIGNED) CAST('-' AS DECIMAL) CAST('-' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '-'
+Warning 1292 Truncated incorrect INTEGER value: '-'
+Warning 1292 Truncated incorrect DECIMAL value: '-'
+Warning 1292 Truncated incorrect DOUBLE value: '-'
+SELECT
+CAST('+' AS SIGNED),
+CAST('+' AS UNSIGNED),
+CAST('+' AS DECIMAL),
+CAST('+' AS DOUBLE);
+CAST('+' AS SIGNED) CAST('+' AS UNSIGNED) CAST('+' AS DECIMAL) CAST('+' AS DOUBLE)
+0 0 0 0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '+'
+Warning 1292 Truncated incorrect INTEGER value: '+'
+Warning 1292 Truncated incorrect DECIMAL value: '+'
+Warning 1292 Truncated incorrect DOUBLE value: '+'
+SELECT
+CAST('1x' AS SIGNED),
+CAST('1x' AS UNSIGNED),
+CAST('1x' AS DECIMAL),
+CAST('1x' AS DOUBLE);
+CAST('1x' AS SIGNED) CAST('1x' AS UNSIGNED) CAST('1x' AS DECIMAL) CAST('1x' AS DOUBLE)
+1 1 1 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1x'
+Warning 1292 Truncated incorrect INTEGER value: '1x'
+Warning 1292 Truncated incorrect DECIMAL value: '1x'
+Warning 1292 Truncated incorrect DOUBLE value: '1x'
+SELECT
+CAST('1e' AS SIGNED),
+CAST('1e' AS UNSIGNED),
+CAST('1e' AS DECIMAL),
+CAST('1e' AS DOUBLE);
+CAST('1e' AS SIGNED) CAST('1e' AS UNSIGNED) CAST('1e' AS DECIMAL) CAST('1e' AS DOUBLE)
+1 1 1 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1e'
+Warning 1292 Truncated incorrect INTEGER value: '1e'
+Warning 1292 Truncated incorrect DECIMAL value: '1e'
+Warning 1292 Truncated incorrect DOUBLE value: '1e'
+SELECT
+CAST('1e-' AS SIGNED),
+CAST('1e-' AS UNSIGNED),
+CAST('1e-' AS DECIMAL),
+CAST('1e-' AS DOUBLE);
+CAST('1e-' AS SIGNED) CAST('1e-' AS UNSIGNED) CAST('1e-' AS DECIMAL) CAST('1e-' AS DOUBLE)
+1 1 1 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1e-'
+Warning 1292 Truncated incorrect INTEGER value: '1e-'
+Warning 1292 Truncated incorrect DECIMAL value: '1e-'
+Warning 1292 Truncated incorrect DOUBLE value: '1e-'
+SELECT
+CAST('1E+' AS SIGNED),
+CAST('1E+' AS UNSIGNED),
+CAST('1E+' AS DECIMAL),
+CAST('1E+' AS DOUBLE);
+CAST('1E+' AS SIGNED) CAST('1E+' AS UNSIGNED) CAST('1E+' AS DECIMAL) CAST('1E+' AS DOUBLE)
+1 1 1 1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1E+'
+Warning 1292 Truncated incorrect INTEGER value: '1E+'
+Warning 1292 Truncated incorrect DECIMAL value: '1E+'
+Warning 1292 Truncated incorrect DOUBLE value: '1E+'
+#
+# End of 10.0 tests
+#
diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result
index 936f48e6122..e15b029e9c6 100644
--- a/mysql-test/r/type_varchar.result
+++ b/mysql-test/r/type_varchar.result
@@ -499,6 +499,7 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's'
+Warning 1292 Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), ('');
@@ -509,6 +510,7 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's '
+Warning 1292 Truncated incorrect DOUBLE value: ' '
DROP TABLE t1;
#
# Start of 10.0 tests
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index b5f6d065174..58cab5ad1ca 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -175,6 +175,8 @@ b'' 0+b''
select x'', 0+x'';
x'' 0+x''
0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
select 0x;
ERROR 42S22: Unknown column '0x' in 'field list'
select 0b;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index cfb7eb1cbdc..eaef3f96ee0 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1350,8 +1350,11 @@ a b
delete from t1;
load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1369 CHECK OPTION failed 'test.v1'
+Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4
Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1 order by a,b;
@@ -5604,8 +5607,12 @@ INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
a
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
a
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a ENUM('5','6'));
@@ -5627,8 +5634,12 @@ INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
a
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
a
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '`1'
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a ENUM('5','6'));
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index 24b95f0e204..b6f0f048c68 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -1161,6 +1161,8 @@ SET NAMES latin1;
SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0)
NULL
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
#
# Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS
#
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
index 4d92d3714c9..a5e4d39eb5f 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
@@ -4818,7 +4818,14 @@ LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow';
affected rows: 3
-info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
+info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 6
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c1' at row 2
+Note 1265 Data truncated for column 'c2' at row 2
+Note 1265 Data truncated for column 'c1' at row 3
+Note 1265 Data truncated for column 'c2' at row 3
#
# Show what we have in the table.
#
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
index 11fa220e896..43c6d9c51b7 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
@@ -4857,7 +4857,14 @@ LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow';
affected rows: 3
-info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
+info: Records: 3 Deleted: 0 Skipped: 0 Warnings: 6
+Warnings:
+Note 1265 Data truncated for column 'c1' at row 1
+Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c1' at row 2
+Note 1265 Data truncated for column 'c2' at row 2
+Note 1265 Data truncated for column 'c1' at row 3
+Note 1265 Data truncated for column 'c2' at row 3
#
# Show what we have in the table.
#
diff --git a/mysql-test/suite/federated/federatedx.result b/mysql-test/suite/federated/federatedx.result
index 5356fcad424..0b0b39f0abd 100644
--- a/mysql-test/suite/federated/federatedx.result
+++ b/mysql-test/suite/federated/federatedx.result
@@ -1689,6 +1689,11 @@ a b c
19 23 437
delete from federated.t1;
load data infile '../../std_data/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
+Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'b' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'b' at row 2
select * from federated.t1 order by a;
a b c
3 4 12
diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result
index fc50c596752..de30240b288 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -2098,8 +2098,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2113,8 +2114,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -2166,8 +2168,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2181,8 +2184,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2198,6 +2202,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
@@ -2213,6 +2218,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result
index fe67cf0c3d6..f8b6dc66d8a 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -2099,8 +2099,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2114,8 +2115,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -2167,8 +2169,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2182,8 +2185,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2199,6 +2203,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
@@ -2214,6 +2219,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result
index fe67cf0c3d6..f8b6dc66d8a 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -2099,8 +2099,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2114,8 +2115,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- '
DROP VIEW v1;
@@ -2167,8 +2169,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2182,8 +2185,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
-Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
+Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
@@ -2199,6 +2203,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1;
@@ -2214,6 +2219,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5
Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 37609c770a5..f0e1ee74e0b 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -13870,7 +13870,7 @@ CALL sp1();
xx
0
Warnings:
-Warning 1265 Data truncated for column 'xx' at row 1
+Warning 1366 Incorrect double value: 'asd' for column 'xx' at row 1
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
diff --git a/mysql-test/suite/maria/maria2.result b/mysql-test/suite/maria/maria2.result
index a0ec440b662..b4b27512054 100644
--- a/mysql-test/suite/maria/maria2.result
+++ b/mysql-test/suite/maria/maria2.result
@@ -46,12 +46,22 @@ drop table t1;
create table t1 (pk int primary key, apk int unique, data int) engine=aria;
insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6);
load data concurrent infile '../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
+Warnings:
+Note 1265 Data truncated for column 'pk' at row 1
+Note 1265 Data truncated for column 'apk' at row 1
+Note 1265 Data truncated for column 'pk' at row 2
+Note 1265 Data truncated for column 'apk' at row 2
select * from t1 order by pk;
pk apk data
1 1 1
3 4 NULL
5 6 NULL
load data infile '../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
+Warnings:
+Note 1265 Data truncated for column 'pk' at row 1
+Note 1265 Data truncated for column 'apk' at row 1
+Note 1265 Data truncated for column 'pk' at row 2
+Note 1265 Data truncated for column 'apk' at row 2
select * from t1 order by pk;
pk apk data
1 1 1
diff --git a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
index 4586fe84d2d..e4fdf0d03a7 100644
--- a/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
+++ b/mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
@@ -247,6 +247,8 @@ UNLOCK TABLES;
select * from `table5` where (col2 <= '6566-06-15' AND col24 <> 'd') group by `col83` order by `col83` desc ;
col0 col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30 col31 col32 col33 col34 col35 col36 col37 col38 col39 col40 col41 col42 col43 col44 col45 col46 col47 col48 col49 col50 col51 col52 col53 col54 col55 col56 col57 col58 col59 col60 col61 col62 col63 col64 col65 col66 col67 col68 col69 col70 col71 col72 col73 col74 col75 col76 col77 col78 col79 col80 col81 col82 col83 col84 col85 col86 col87 col88 col89 col90 col91 col92 col93 col94 col95 col96 col97 col98 col99 col100 col101 col102 col103 col104 col105 col106 col107 col108 col109 col110 col111 col112 col113 col114 col115 col116 col117 col118 col119 col120 col121 col122 col123 col124 col125 col126 col127 col128 col129 col130 col131 col132 col133 col134 col135 col136 col137 col138 col139 col140 col141 col142 col143 col144 col145 col146 col147 col148 col149 col150 col151 col152 col153 col154 col155 col156 col157 col158 col159 col160 col161 col162 col163 col164 col165 col166 col167 col168 col169 col170 col171 col172 col173 col174 col175
Warnings:
-Warning 1366 Incorrect decimal value: 'd' for column 'col24' at row 1
-Warning 1366 Incorrect decimal value: 'd' for column 'col24' at row 1
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
drop table `table5`;
diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
index d9b6006fbb0..57754183483 100644
--- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result
+++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
@@ -63,8 +63,11 @@ drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
+Note 1265 Data truncated for column 'a' at row 4
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from rewrite.t1;
@@ -77,6 +80,9 @@ a b
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings:
+Note 1265 Data truncated for column 'a' at row 1
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect integer value: '
' for column 'a' at row 4
Warning 1261 Row 4 doesn't contain data for all columns
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 5dd0a5f426c..18fe32c526b 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -882,7 +882,7 @@ DO CAST(CONVERT('' USING ucs2) AS UNSIGNED);
CREATE TABLE t1 (a DECIMAL(2,0));
SET sql_mode='strict_all_tables';
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+--error ER_WARN_DATA_OUT_OF_RANGE
INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2));
SET sql_mode=DEFAULT;
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index c1a21c8ac85..a47fbe7a372 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -2606,7 +2606,7 @@ delimiter |;
CREATE PROCEDURE p1()
BEGIN
DECLARE c INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p2();
CALL p3();
CALL p4();
@@ -2641,7 +2641,7 @@ CREATE PROCEDURE p5()
CREATE PROCEDURE P6()
BEGIN
DECLARE c INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
+ DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
CALL p5();
SELECT c;
END|
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index 71b625e0843..b1d36447e00 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -750,7 +750,7 @@ INSERT INTO t1 VALUES ('-101.55');
INSERT INTO t1 VALUES ('-1010.55');
--error 1264
INSERT INTO t1 VALUES ('-100E+1');
---error 1366
+--error WARN_DATA_TRUNCATED
INSERT INTO t1 VALUES ('-100E');
--error 1264
UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
@@ -764,7 +764,7 @@ INSERT INTO t1 (col1) VALUES ('');
#--error 1265
--error 1366
INSERT INTO t1 (col1) VALUES ('a59b');
---error 1366
+--error WARN_DATA_TRUNCATED
INSERT INTO t1 (col1) VALUES ('1a');
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
INSERT IGNORE INTO t1 values (1/0);
@@ -796,9 +796,9 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
---error 1265
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('');
---error 1265
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('a59b');
--error 1265
INSERT INTO t1 (col1) VALUES ('1a');
@@ -830,9 +830,9 @@ UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
---error 1265
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('');
---error 1265
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('a59b');
--error 1265
INSERT INTO t1 (col1) VALUES ('1a');
diff --git a/mysql-test/t/type_num.test b/mysql-test/t/type_num.test
new file mode 100644
index 00000000000..6ed04c8e1d3
--- /dev/null
+++ b/mysql-test/t/type_num.test
@@ -0,0 +1,683 @@
+--echo #
+--echo # Start of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
+--echo #
+SET sql_mode='STRICT_ALL_TABLES';
+
+CREATE TABLE t1 (a FLOAT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+INSERT INTO t1 VALUES ('1 ');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('x');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES (' x');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('.');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('-');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+INSERT INTO t1 VALUES ('+');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1x');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1E-');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1Ex');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error WARN_DATA_TRUNCATED
+INSERT INTO t1 VALUES ('1e+x');
+DROP TABLE t1;
+
+
+CREATE TABLE t1 (a FLOAT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a TINYINT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a SMALLINT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a BIGINT);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL);
+--error ER_WARN_DATA_OUT_OF_RANGE
+INSERT INTO t1 VALUES ('1e1000');
+DROP TABLE t1;
+
+
+SET sql_mode=DEFAULT;
+
+CREATE TABLE t1 (
+ f4 FLOAT,
+ f8 DOUBLE,
+ i1 TINYINT,
+ i2 SMALLINT,
+ i4 INT,
+ i8 BIGINT,
+ d DECIMAL
+);
+
+INSERT INTO t1 VALUES ('1 ','1 ','1 ','1 ','1 ','1 ','1 ');
+INSERT INTO t1 VALUES ('','','','','','','');
+INSERT INTO t1 VALUES ('x','x','x','x','x','x','x');
+INSERT INTO t1 VALUES (' x',' x',' x',' x',' x',' x',' x');
+INSERT INTO t1 VALUES ('.','.','.','.','.','.','.');
+INSERT INTO t1 VALUES ('-','-','-','-','-','-','-');
+INSERT INTO t1 VALUES ('+','+','+','+','+','+','+');
+INSERT INTO t1 VALUES ('1x','1x','1x','1x','1x','1x','1x');
+INSERT INTO t1 VALUES ('1e','1e','1e','1e','1e','1e','1e');
+INSERT INTO t1 VALUES ('1e-','1e-','1e-','1e-','1e-','1e-','1e-');
+INSERT INTO t1 VALUES ('1E+','1E+','1E+','1E+','1E+','1E+','1E+');
+INSERT INTO t1 VALUES ('1e1000','1e1000','1e1000','1e1000','1e1000','1e1000','1e1000');
+
+DELETE FROM t1;
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
+INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
+INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
+INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
+INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
+INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
+INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
+INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
+INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
+INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
+INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
+
+SELECT COUNT(*) FROM t1 WHERE f4='1 ';
+SELECT COUNT(*) FROM t1 WHERE f8='1 ';
+SELECT COUNT(*) FROM t1 WHERE i1='1 ';
+SELECT COUNT(*) FROM t1 WHERE i2='1 ';
+SELECT COUNT(*) FROM t1 WHERE i4='1 ';
+SELECT COUNT(*) FROM t1 WHERE i8='1 ';
+SELECT COUNT(*) FROM t1 WHERE d='1 ';
+
+SELECT COUNT(*) FROM t1 WHERE f4='';
+SELECT COUNT(*) FROM t1 WHERE f8='';
+SELECT COUNT(*) FROM t1 WHERE i1='';
+SELECT COUNT(*) FROM t1 WHERE i2='';
+SELECT COUNT(*) FROM t1 WHERE i4='';
+SELECT COUNT(*) FROM t1 WHERE i8='';
+SELECT COUNT(*) FROM t1 WHERE d='';
+
+SELECT COUNT(*) FROM t1 WHERE f4='x';
+SELECT COUNT(*) FROM t1 WHERE f8='x';
+SELECT COUNT(*) FROM t1 WHERE i1='x';
+SELECT COUNT(*) FROM t1 WHERE i2='x';
+SELECT COUNT(*) FROM t1 WHERE i4='x';
+SELECT COUNT(*) FROM t1 WHERE i8='x';
+SELECT COUNT(*) FROM t1 WHERE d='x';
+
+SELECT COUNT(*) FROM t1 WHERE f4=' x';
+SELECT COUNT(*) FROM t1 WHERE f8=' x';
+SELECT COUNT(*) FROM t1 WHERE i1=' x';
+SELECT COUNT(*) FROM t1 WHERE i2=' x';
+SELECT COUNT(*) FROM t1 WHERE i4=' x';
+SELECT COUNT(*) FROM t1 WHERE i8=' x';
+SELECT COUNT(*) FROM t1 WHERE d=' x';
+
+SELECT COUNT(*) FROM t1 WHERE f4='.';
+SELECT COUNT(*) FROM t1 WHERE f8='.';
+SELECT COUNT(*) FROM t1 WHERE i1='.';
+SELECT COUNT(*) FROM t1 WHERE i2='.';
+SELECT COUNT(*) FROM t1 WHERE i4='.';
+SELECT COUNT(*) FROM t1 WHERE i8='.';
+SELECT COUNT(*) FROM t1 WHERE d='.';
+
+SELECT COUNT(*) FROM t1 WHERE f4='-';
+SELECT COUNT(*) FROM t1 WHERE f8='-';
+SELECT COUNT(*) FROM t1 WHERE i1='-';
+SELECT COUNT(*) FROM t1 WHERE i2='-';
+SELECT COUNT(*) FROM t1 WHERE i4='-';
+SELECT COUNT(*) FROM t1 WHERE i8='-';
+SELECT COUNT(*) FROM t1 WHERE d='-';
+
+SELECT COUNT(*) FROM t1 WHERE f4='+';
+SELECT COUNT(*) FROM t1 WHERE f8='+';
+SELECT COUNT(*) FROM t1 WHERE i1='+';
+SELECT COUNT(*) FROM t1 WHERE i2='+';
+SELECT COUNT(*) FROM t1 WHERE i4='+';
+SELECT COUNT(*) FROM t1 WHERE i8='+';
+SELECT COUNT(*) FROM t1 WHERE d='+';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1x';
+SELECT COUNT(*) FROM t1 WHERE f8='1x';
+SELECT COUNT(*) FROM t1 WHERE i1='1x';
+SELECT COUNT(*) FROM t1 WHERE i2='1x';
+SELECT COUNT(*) FROM t1 WHERE i4='1x';
+SELECT COUNT(*) FROM t1 WHERE i8='1x';
+SELECT COUNT(*) FROM t1 WHERE d='1x';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1e';
+SELECT COUNT(*) FROM t1 WHERE f8='1e';
+SELECT COUNT(*) FROM t1 WHERE i1='1e';
+SELECT COUNT(*) FROM t1 WHERE i2='1e';
+SELECT COUNT(*) FROM t1 WHERE i4='1e';
+SELECT COUNT(*) FROM t1 WHERE i8='1e';
+SELECT COUNT(*) FROM t1 WHERE d='1e';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1e+';
+SELECT COUNT(*) FROM t1 WHERE f8='1e+';
+SELECT COUNT(*) FROM t1 WHERE i1='1e+';
+SELECT COUNT(*) FROM t1 WHERE i2='1e+';
+SELECT COUNT(*) FROM t1 WHERE i4='1e+';
+SELECT COUNT(*) FROM t1 WHERE i8='1e+';
+SELECT COUNT(*) FROM t1 WHERE d='1e+';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1E-';
+SELECT COUNT(*) FROM t1 WHERE f8='1E-';
+SELECT COUNT(*) FROM t1 WHERE i1='1E-';
+SELECT COUNT(*) FROM t1 WHERE i2='1E-';
+SELECT COUNT(*) FROM t1 WHERE i4='1E-';
+SELECT COUNT(*) FROM t1 WHERE i8='1E-';
+SELECT COUNT(*) FROM t1 WHERE d='1E-';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1Ex';
+SELECT COUNT(*) FROM t1 WHERE f8='1Ex';
+SELECT COUNT(*) FROM t1 WHERE i1='1Ex';
+SELECT COUNT(*) FROM t1 WHERE i2='1Ex';
+SELECT COUNT(*) FROM t1 WHERE i4='1Ex';
+SELECT COUNT(*) FROM t1 WHERE i8='1Ex';
+SELECT COUNT(*) FROM t1 WHERE d='1Ex';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1e+x';
+SELECT COUNT(*) FROM t1 WHERE f8='1e+x';
+SELECT COUNT(*) FROM t1 WHERE i1='1e+x';
+SELECT COUNT(*) FROM t1 WHERE i2='1e+x';
+SELECT COUNT(*) FROM t1 WHERE i4='1e+x';
+SELECT COUNT(*) FROM t1 WHERE i8='1e+x';
+SELECT COUNT(*) FROM t1 WHERE d='1e+x';
+
+SELECT COUNT(*) FROM t1 WHERE f4='1e1000';
+SELECT COUNT(*) FROM t1 WHERE f8='1e1000';
+SELECT COUNT(*) FROM t1 WHERE i1='1e1000';
+SELECT COUNT(*) FROM t1 WHERE i2='1e1000';
+SELECT COUNT(*) FROM t1 WHERE i4='1e1000';
+SELECT COUNT(*) FROM t1 WHERE i8='1e1000';
+SELECT COUNT(*) FROM t1 WHERE d='1e1000';
+
+ALTER TABLE t1
+ ADD KEY f4(f4),
+ ADD KEY f8(f8),
+ ADD KEY i1(i1),
+ ADD KEY i2(i2),
+ ADD KEY i4(i4),
+ ADD KEY i8(i8),
+ ADD KEY d(d);
+
+SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='1 ';
+SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='1 ';
+
+SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='';
+SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='';
+
+# TODO: Add tests for all of the other tricky examples (see above) when
+# MDEV-8490 INT,DOUBLE,DECIMAL produce different warnings on comparison
+# is fixed
+
+DROP TABLE t1;
+
+SELECT
+ CAST('1 ' AS SIGNED),
+ CAST('1 ' AS UNSIGNED),
+ CAST('1 ' AS DECIMAL),
+ CAST('1 ' AS DOUBLE);
+
+SELECT
+ CAST('' AS SIGNED),
+ CAST('' AS UNSIGNED),
+ CAST('' AS DECIMAL),
+ CAST('' AS DOUBLE);
+
+SELECT
+ CAST('x' AS SIGNED),
+ CAST('x' AS UNSIGNED),
+ CAST('x' AS DECIMAL),
+ CAST('x' AS DOUBLE);
+
+SELECT
+ CAST(' x' AS SIGNED),
+ CAST(' x' AS UNSIGNED),
+ CAST(' x' AS DECIMAL),
+ CAST(' x' AS DOUBLE);
+
+SELECT
+ CAST('.' AS SIGNED),
+ CAST('.' AS UNSIGNED),
+ CAST('.' AS DECIMAL),
+ CAST('.' AS DOUBLE);
+
+SELECT
+ CAST('-' AS SIGNED),
+ CAST('-' AS UNSIGNED),
+ CAST('-' AS DECIMAL),
+ CAST('-' AS DOUBLE);
+
+SELECT
+ CAST('+' AS SIGNED),
+ CAST('+' AS UNSIGNED),
+ CAST('+' AS DECIMAL),
+ CAST('+' AS DOUBLE);
+
+SELECT
+ CAST('1x' AS SIGNED),
+ CAST('1x' AS UNSIGNED),
+ CAST('1x' AS DECIMAL),
+ CAST('1x' AS DOUBLE);
+
+SELECT
+ CAST('1e' AS SIGNED),
+ CAST('1e' AS UNSIGNED),
+ CAST('1e' AS DECIMAL),
+ CAST('1e' AS DOUBLE);
+
+SELECT
+ CAST('1e-' AS SIGNED),
+ CAST('1e-' AS UNSIGNED),
+ CAST('1e-' AS DECIMAL),
+ CAST('1e-' AS DOUBLE);
+
+SELECT
+ CAST('1E+' AS SIGNED),
+ CAST('1E+' AS UNSIGNED),
+ CAST('1E+' AS DECIMAL),
+ CAST('1E+' AS DOUBLE);
+
+# TODO: Uncomment this test when
+# MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
+# is fixed
+#SELECT
+# CAST('1e1000' AS SIGNED),
+# CAST('1e1000' AS UNSIGNED),
+# CAST('1e1000' AS DECIMAL),
+# CAST('1e1000' AS DOUBLE);
+
+
+--echo #
+--echo # End of 10.0 tests
+--echo #
diff --git a/sql/field.cc b/sql/field.cc
index 0d38ac1a633..bacab1f79f4 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1055,37 +1055,6 @@ Item_result Field::result_merge_type(enum_field_types field_type)
*****************************************************************************/
/**
- Output a warning for erroneous conversion of strings to numerical
- values. For use with ER_TRUNCATED_WRONG_VALUE[_FOR_FIELD]
-
- @param thd THD object
- @param str pointer to string that failed to be converted
- @param length length of string
- @param cs charset for string
- @param typestr string describing type converted to
- @param error error value to output
- @param field_name (for *_FOR_FIELD) name of field
- @param row_num (for *_FOR_FIELD) row number
- */
-static void push_numerical_conversion_warning(THD* thd, const char* str,
- uint length, CHARSET_INFO* cs,
- const char* typestr, int error,
- const char* field_name="UNKNOWN",
- ulong row_num=0)
-{
- char buf[MY_MAX(MY_MAX(DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE,
- LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE),
- DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE)];
-
- String tmp(buf, sizeof(buf), cs);
- tmp.copy(str, length, cs);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- error, ER_THD(thd, error), typestr, tmp.c_ptr(),
- field_name, row_num);
-}
-
-
-/**
Check whether a field type can be partially indexed by a key.
This is a static method, rather than a virtual function, because we need
@@ -1389,43 +1358,132 @@ Item *Field_num::get_equal_zerofill_const_item(THD *thd, const Context &ctx,
/**
- Test if given number is a int.
+ Contruct warning parameters using thd->no_errors
+ to determine whether to generate or suppress warnings.
+ We can get here in a query like this:
+ SELECT COUNT(@@basedir);
+ from Item_func_get_system_var::update_null_value().
+*/
+Value_source::Warn_filter::Warn_filter(const THD *thd)
+ :m_want_warning_edom(!thd->no_errors),
+ m_want_note_truncated_spaces(!thd->no_errors)
+{ }
- @todo
- Make this multi-byte-character safe
- @param str String to test
+/**
+ Check string-to-number conversion and produce a warning if
+ - could not convert any digits (EDOM-alike error)
+ - found garbage at the end of the string
+ - found trailing spaces (a note)
+ See also Field_num::check_edom_and_truncation() for a similar function.
+
+ @param thd - the thread
+ @param filter - which warnings/notes are allowed
+ @param type - name of the data type (e.g. "INTEGER", "DECIMAL", "DOUBLE")
+ @param cs - character set of the original string
+ @param str - the original string
+ @param end - the end of the string
+
+ Unlike Field_num::check_edom_and_truncation(), this function does not
+ distinguish between EDOM and truncation and reports the same warning for
+ both cases. Perhaps we should eventually print different warnings, to make
+ the explicit CAST work closer to the implicit cast in Field_xxx::store().
+*/
+void
+Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd,
+ Warn_filter filter,
+ const char *type,
+ CHARSET_INFO *cs,
+ const char *str,
+ size_t length) const
+{
+ DBUG_ASSERT(str <= m_end_of_num);
+ DBUG_ASSERT(m_end_of_num <= str + length);
+ if (m_edom || (m_end_of_num < str + length &&
+ !check_if_only_end_space(cs, m_end_of_num, str + length)))
+ {
+ // EDOM or important trailing data truncation
+ if (filter.want_warning_edom())
+ {
+ /*
+ We can use err.ptr() here as ErrConvString is guranteed to put an
+ end \0 here.
+ */
+ THD *wthd= thd ? thd : current_thd;
+ push_warning_printf(wthd, Sql_condition::WARN_LEVEL_WARN,
+ ER_TRUNCATED_WRONG_VALUE,
+ ER_THD(wthd, ER_TRUNCATED_WRONG_VALUE), type,
+ ErrConvString(str, length, cs).ptr());
+ }
+ }
+ else if (m_end_of_num < str + length)
+ {
+ // Unimportant trailing data (spaces) truncation
+ if (filter.want_note_truncated_spaces())
+ {
+ THD *wthd= thd ? thd : current_thd;
+ push_warning_printf(wthd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_TRUNCATED_WRONG_VALUE,
+ ER_THD(wthd, ER_TRUNCATED_WRONG_VALUE), type,
+ ErrConvString(str, length, cs).ptr());
+ }
+ }
+}
+
+
+/**
+ Check a string-to-number conversion routine result and generate warnings
+ in case when it:
+ - could not convert any digits
+ - found garbage at the end of the string.
+
+ @param type Data type name (e.g. "decimal", "integer", "double")
+ @param edom Indicates that the string-to-number routine retuned
+ an error code equivalent to EDOM (value out of domain),
+ i.e. the string fully consisted of garbage and the
+ conversion routine could not get any digits from it.
+ @param str The original string
@param length Length of 'str'
- @param int_end Pointer to char after last used digit
- @param cs Character set
+ @param cs Character set
+ @param end Pointer to char after last used digit
@note
- This is called after one has called strntoull10rnd() function.
+ This is called after one has called one of the following functions:
+ - strntoull10rnd()
+ - my_strntod()
+ - str2my_decimal()
@retval
- 0 OK
+ 0 OK
@retval
- 1 error: empty string or wrong integer.
+ 1 error: could not scan any digits (EDOM),
+ e.g. empty string, or garbage.
@retval
- 2 error: garbage at the end of string.
+ 2 error: scanned some digits,
+ but then found garbage at the end of the string.
*/
-int Field_num::check_int(CHARSET_INFO *cs, const char *str, int length,
- const char *int_end, int error)
+
+int Field_num::check_edom_and_truncation(const char *type, bool edom,
+ CHARSET_INFO *cs,
+ const char *str, uint length,
+ const char *end)
{
- /* Test if we get an empty string or wrong integer */
- if (str == int_end || error == MY_ERRNO_EDOM)
+ /* Test if we get an empty string or garbage */
+ if (edom)
{
ErrConvString err(str, length, cs);
- set_warning_truncated_wrong_value("integer", err.ptr());
+ set_warning_truncated_wrong_value(type, err.ptr());
return 1;
}
/* Test if we have garbage at the end of the given string. */
- if (test_if_important_data(cs, int_end, str + length))
+ if (test_if_important_data(cs, end, str + length))
{
set_warning(WARN_DATA_TRUNCATED, 1);
return 2;
}
+ if (end < str + length)
+ set_note(WARN_DATA_TRUNCATED, 1);
return 0;
}
@@ -1497,6 +1555,24 @@ out_of_range:
}
+double Field_real::get_double(const char *str, uint length, CHARSET_INFO *cs,
+ int *error)
+{
+ char *end;
+ double nr= my_strntod(cs,(char*) str, length, &end, error);
+ if (*error)
+ {
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
+ *error= 1;
+ }
+ else if (get_thd()->count_cuted_fields &&
+ check_edom_and_truncation("double", str == end,
+ cs, str, length, end))
+ *error= 1;
+ return nr;
+}
+
+
/**
Process decimal library return codes and issue warnings for overflow and
truncation.
@@ -2962,36 +3038,60 @@ int Field_new_decimal::store(const char *from, uint length,
CHARSET_INFO *charset_arg)
{
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
- int err;
my_decimal decimal_value;
+ THD *thd= get_thd();
DBUG_ENTER("Field_new_decimal::store(char*)");
- if ((err= str2my_decimal(E_DEC_FATAL_ERROR &
- ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
+ const char *end;
+ int err= str2my_decimal(E_DEC_FATAL_ERROR &
+ ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
from, length, charset_arg,
- &decimal_value)) &&
- get_thd()->abort_on_warning)
+ &decimal_value, &end);
+
+ if (err == E_DEC_OVERFLOW) // Too many digits (>81) in the integer part
{
- ErrConvString errmsg(from, length, charset_arg);
- set_warning_truncated_wrong_value("decimal", errmsg.ptr());
- DBUG_RETURN(err);
+ set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
+ if (!thd->abort_on_warning)
+ {
+ set_value_on_overflow(&decimal_value, decimal_value.sign());
+ store_decimal(&decimal_value);
+ }
+ DBUG_RETURN(1);
}
- switch (err) {
- case E_DEC_TRUNCATED:
- set_note(WARN_DATA_TRUNCATED, 1);
- break;
- case E_DEC_OVERFLOW:
- set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
- set_value_on_overflow(&decimal_value, decimal_value.sign());
- break;
- case E_DEC_BAD_NUM:
+ if (thd->count_cuted_fields)
+ {
+ if (check_edom_and_truncation("decimal",
+ err && err != E_DEC_TRUNCATED,
+ charset_arg, from, length, end))
{
- ErrConvString errmsg(from, length, charset_arg);
- set_warning_truncated_wrong_value("decimal", errmsg.ptr());
- my_decimal_set_zero(&decimal_value);
- break;
+ if (!thd->abort_on_warning)
+ {
+ if (err && err != E_DEC_TRUNCATED)
+ {
+ /*
+ If check_decimal() failed because of EDOM-alike error,
+ (e.g. E_DEC_BAD_NUM), we have to initialize decimal_value to zero.
+ Note: if check_decimal() failed because of truncation,
+ decimal_value is alreay properly initialized.
+ */
+ my_decimal_set_zero(&decimal_value);
+ /*
+ TODO: check str2my_decimal() with HF. It seems to do
+ decimal_make_zero() on fatal errors, so my_decimal_set_zero()
+ is probably not needed here.
+ */
+ }
+ store_decimal(&decimal_value);
+ }
+ DBUG_RETURN(1);
}
+ /*
+ E_DEC_TRUNCATED means minor truncation '1e-1000000000000' -> 0.0
+ A note should be enough.
+ */
+ if (err == E_DEC_TRUNCATED)
+ set_note(WARN_DATA_TRUNCATED, 1);
}
#ifndef DBUG_OFF
@@ -3000,7 +3100,7 @@ int Field_new_decimal::store(const char *from, uint length,
dbug_decimal_as_string(dbug_buff, &decimal_value)));
#endif
store_value(&decimal_value);
- DBUG_RETURN(err);
+ DBUG_RETURN(0);
}
@@ -4212,15 +4312,7 @@ void Field_longlong::sql_type(String &res) const
int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
{
int error;
- char *end;
- double nr= my_strntod(cs,(char*) from,len,&end,&error);
- if (error || (!len || ((uint) (end-from) != len &&
- get_thd()->count_cuted_fields)))
- {
- set_warning(error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED, 1);
- error= error ? 1 : 2;
- }
- Field_float::store(nr);
+ Field_float::store(get_double(from, len, cs, &error));
return error;
}
@@ -4399,15 +4491,7 @@ void Field_float::sql_type(String &res) const
int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
{
int error;
- char *end;
- double nr= my_strntod(cs,(char*) from, len, &end, &error);
- if (error || (!len || ((uint) (end-from) != len &&
- get_thd()->count_cuted_fields)))
- {
- set_warning(error ? ER_WARN_DATA_OUT_OF_RANGE : WARN_DATA_TRUNCATED, 1);
- error= error ? 1 : 2;
- }
- Field_double::store(nr);
+ Field_double::store(get_double(from, len, cs, &error));
return error;
}
@@ -6853,53 +6937,41 @@ bool Field_longstr::can_optimize_group_min_max(const Item_bool_func *cond,
}
+/**
+ This overrides the default behavior of the parent constructor
+ Warn_filter(thd) to suppress notes about trailing spaces in case of CHAR(N),
+ as they are truncated during val_str().
+ We still do want truncation notes in case of BINARY(N),
+ as trailing spaces are not truncated in val_str().
+*/
+Field_string::Warn_filter_string::Warn_filter_string(const THD *thd,
+ const Field_string *field)
+ :Warn_filter(!thd->no_errors,
+ !thd->no_errors &&
+ field->Field_string::charset() == &my_charset_bin)
+{ }
+
+
double Field_string::val_real(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int error;
- char *end;
- CHARSET_INFO *cs= charset();
- double result;
THD *thd= get_thd();
-
- result= my_strntod(cs,(char*) ptr,field_length,&end,&error);
- if (!thd->no_errors &&
- (error || (field_length != (uint32)(end - (char*) ptr) &&
- !check_if_only_end_space(cs, end,
- (char*) ptr + field_length))))
- {
- ErrConvString err((char*) ptr, field_length, cs);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), "DOUBLE",
- err.ptr());
- }
- return result;
+ return Converter_strntod_with_warn(get_thd(),
+ Warn_filter_string(thd, this),
+ Field_string::charset(),
+ (const char *) ptr,
+ field_length).result();
}
longlong Field_string::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int error;
- char *end;
- CHARSET_INFO *cs= charset();
- longlong result;
THD *thd= get_thd();
-
- result= my_strntoll(cs, (char*) ptr,field_length,10,&end,&error);
- if (!thd->no_errors &&
- (error || (field_length != (uint32)(end - (char*) ptr) &&
- !check_if_only_end_space(cs, end,
- (char*) ptr + field_length))))
- {
- ErrConvString err((char*) ptr, field_length, cs);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER_THD(thd, ER_TRUNCATED_WRONG_VALUE),
- "INTEGER", err.ptr());
- }
- return result;
+ return Converter_strntoll_with_warn(thd, Warn_filter_string(thd, this),
+ Field_string::charset(),
+ (const char *) ptr,
+ field_length).result();
}
@@ -6922,30 +6994,17 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
}
-my_decimal *Field_longstr::val_decimal_from_str(const char *str,
- uint length,
- CHARSET_INFO *cs,
- my_decimal *decimal_value)
-{
- THD *thd;
- int err= str2my_decimal(E_DEC_FATAL_ERROR, str, length, cs, decimal_value);
- if (err && !(thd= get_thd())->no_errors)
- {
- ErrConvString errmsg(str, length, cs);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER_THD(thd, ER_TRUNCATED_WRONG_VALUE),
- "DECIMAL", errmsg.ptr());
- }
- return decimal_value;
-}
-
-
my_decimal *Field_string::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- return val_decimal_from_str((const char *) ptr, field_length,
- Field_string::charset(), decimal_value);
+ THD *thd= get_thd();
+ Converter_str2my_decimal_with_warn(thd,
+ Warn_filter_string(thd, this),
+ E_DEC_FATAL_ERROR,
+ Field_string::charset(),
+ (const char *) ptr,
+ field_length, decimal_value);
+ return decimal_value;
}
@@ -7310,54 +7369,30 @@ int Field_varstring::store(longlong nr, bool unsigned_val)
double Field_varstring::val_real(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int error;
- char *end;
- double result;
- CHARSET_INFO* cs= charset();
-
- uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
- result= my_strntod(cs, (char*)ptr+length_bytes, length, &end, &error);
-
- if (!get_thd()->no_errors &&
- (error || (length != (uint)(end - (char*)ptr+length_bytes) &&
- !check_if_only_end_space(cs, end, (char*)ptr+length_bytes+length))))
- {
- push_numerical_conversion_warning(get_thd(), (char*)ptr+length_bytes,
- length, cs,"DOUBLE",
- ER_TRUNCATED_WRONG_VALUE);
- }
- return result;
+ THD *thd= get_thd();
+ return Converter_strntod_with_warn(thd, Warn_filter(thd),
+ Field_varstring::charset(),
+ (const char *) get_data(),
+ get_length()).result();
}
longlong Field_varstring::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int error;
- char *end;
- CHARSET_INFO *cs= charset();
-
- uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
- longlong result= my_strntoll(cs, (char*) ptr+length_bytes, length, 10,
- &end, &error);
-
- if (!get_thd()->no_errors &&
- (error || (length != (uint)(end - (char*)ptr+length_bytes) &&
- !check_if_only_end_space(cs, end, (char*)ptr+length_bytes+length))))
- {
- push_numerical_conversion_warning(get_thd(), (char*)ptr+length_bytes,
- length, cs, "INTEGER",
- ER_TRUNCATED_WRONG_VALUE);
- }
- return result;
+ THD *thd= get_thd();
+ return Converter_strntoll_with_warn(thd, Warn_filter(thd),
+ Field_varstring::charset(),
+ (const char *) get_data(),
+ get_length()).result();
}
+
String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
- val_ptr->set((const char*) ptr+length_bytes, length, field_charset);
+ val_ptr->set((const char*) get_data(), get_length(), field_charset);
return val_ptr;
}
@@ -7365,9 +7400,14 @@ String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
- return val_decimal_from_str((const char *) ptr + length_bytes, length,
- Field_varstring::charset(), decimal_value);
+ THD *thd= get_thd();
+ Converter_str2my_decimal_with_warn(thd, Warn_filter(thd),
+ E_DEC_FATAL_ERROR,
+ Field_varstring::charset(),
+ (const char *) get_data(),
+ get_length(), decimal_value);
+ return decimal_value;
+
}
@@ -7821,32 +7861,31 @@ int Field_blob::store(longlong nr, bool unsigned_val)
double Field_blob::val_real(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int not_used;
- char *end_not_used, *blob;
- uint32 length;
- CHARSET_INFO *cs;
-
+ char *blob;
memcpy(&blob, ptr+packlength, sizeof(char*));
if (!blob)
return 0.0;
- length= get_length(ptr);
- cs= charset();
- return my_strntod(cs, blob, length, &end_not_used, &not_used);
+ THD *thd= get_thd();
+ return Converter_strntod_with_warn(thd, Warn_filter(thd),
+ Field_blob::charset(),
+ blob, get_length(ptr)).result();
}
longlong Field_blob::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
- int not_used;
char *blob;
memcpy(&blob, ptr+packlength, sizeof(char*));
if (!blob)
return 0;
- uint32 length=get_length(ptr);
- return my_strntoll(charset(),blob,length,10,NULL,&not_used);
+ THD *thd= get_thd();
+ return Converter_strntoll_with_warn(thd, Warn_filter(thd),
+ Field_blob::charset(),
+ blob, get_length(ptr)).result();
}
+
String *Field_blob::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr)
{
@@ -7875,8 +7914,12 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
else
length= get_length(ptr);
- return val_decimal_from_str(blob, length,
- Field_blob::charset(), decimal_value);
+ THD *thd= get_thd();
+ Converter_str2my_decimal_with_warn(thd, Warn_filter(thd),
+ E_DEC_FATAL_ERROR,
+ Field_blob::charset(),
+ blob, length, decimal_value);
+ return decimal_value;
}
diff --git a/sql/field.h b/sql/field.h
index cd6c476671b..7b76512bc69 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -56,6 +56,231 @@ enum enum_check_fields
*/
class Value_source
{
+protected:
+
+ // Parameters for warning and note generation
+ class Warn_filter
+ {
+ bool m_want_warning_edom;
+ bool m_want_note_truncated_spaces;
+ public:
+ Warn_filter(bool want_warning_edom, bool want_note_truncated_spaces) :
+ m_want_warning_edom(want_warning_edom),
+ m_want_note_truncated_spaces(want_note_truncated_spaces)
+ { }
+ Warn_filter(const THD *thd);
+ bool want_warning_edom() const
+ { return m_want_warning_edom; }
+ bool want_note_truncated_spaces() const
+ { return m_want_note_truncated_spaces; }
+ };
+ class Warn_filter_all: public Warn_filter
+ {
+ public:
+ Warn_filter_all() :Warn_filter(true, true) { }
+ };
+
+
+ // String-to-number converters
+ class Converter_string_to_number
+ {
+ protected:
+ char *m_end_of_num; // Where the low-level conversion routine stopped
+ int m_error; // The error code returned by the low-level routine
+ bool m_edom; // If EDOM-alike error happened during conversion
+ /**
+ Check string-to-number conversion and produce a warning if
+ - could not convert any digits (EDOM-alike error)
+ - found garbage at the end of the string
+ - found extra spaces at the end (a note)
+ See also Field_num::check_edom_and_truncation() for a similar function.
+
+ @param thd - the thread that will be used to generate warnings.
+ Can be NULL (which means current_thd will be used
+ if a warning is really necessary).
+ @param type - name of the data type
+ (e.g. "INTEGER", "DECIMAL", "DOUBLE")
+ @param cs - character set of the original string
+ @param str - the original string
+ @param end - the end of the string
+ @param allow_notes - tells if trailing space notes should be displayed
+ or suppressed.
+
+ Unlike Field_num::check_edom_and_truncation(), this function does not
+ distinguish between EDOM and truncation and reports the same warning for
+ both cases. Perhaps we should eventually print different warnings,
+ to make the explicit CAST work closer to the implicit cast in
+ Field_xxx::store().
+ */
+ void check_edom_and_truncation(THD *thd, Warn_filter filter,
+ const char *type,
+ CHARSET_INFO *cs,
+ const char *str,
+ size_t length) const;
+ public:
+ int error() const { return m_error; }
+ };
+
+ class Converter_strntod: public Converter_string_to_number
+ {
+ double m_result;
+ public:
+ Converter_strntod(CHARSET_INFO *cs, const char *str, size_t length)
+ {
+ m_result= my_strntod(cs, (char *) str, length, &m_end_of_num, &m_error);
+ // strntod() does not set an error if the input string was empty
+ m_edom= m_error !=0 || str == m_end_of_num;
+ }
+ double result() const { return m_result; }
+ };
+
+ class Converter_string_to_longlong: public Converter_string_to_number
+ {
+ protected:
+ longlong m_result;
+ public:
+ longlong result() const { return m_result; }
+ };
+
+ class Converter_strntoll: public Converter_string_to_longlong
+ {
+ public:
+ Converter_strntoll(CHARSET_INFO *cs, const char *str, size_t length)
+ {
+ m_result= my_strntoll(cs, str, length, 10, &m_end_of_num, &m_error);
+ /*
+ All non-zero errors means EDOM error.
+ strntoll() does not set an error if the input string was empty.
+ Check it here.
+ Notice the different with the same condition in Converter_strntoll10.
+ */
+ m_edom= m_error != 0 || str == m_end_of_num;
+ }
+ };
+
+ class Converter_strtoll10: public Converter_string_to_longlong
+ {
+ public:
+ Converter_strtoll10(CHARSET_INFO *cs, const char *str, size_t length)
+ {
+ m_end_of_num= (char *) str + length;
+ m_result= (*(cs->cset->strtoll10))(cs, str, &m_end_of_num, &m_error);
+ /*
+ Negative error means "good negative number".
+ Only a positive m_error value means a real error.
+ strtoll10() sets error to MY_ERRNO_EDOM in case of an empty string,
+ so we don't have to additionally catch empty strings here.
+ */
+ m_edom= m_error > 0;
+ }
+ };
+
+ class Converter_str2my_decimal: public Converter_string_to_number
+ {
+ public:
+ Converter_str2my_decimal(uint mask,
+ CHARSET_INFO *cs, const char *str, size_t length,
+ my_decimal *buf)
+ {
+ m_error= str2my_decimal(mask, str, length, cs,
+ buf, (const char **) &m_end_of_num);
+ // E_DEC_TRUNCATED means a very minor truncation: '1e-100' -> 0
+ m_edom= m_error && m_error != E_DEC_TRUNCATED;
+ }
+ };
+
+
+ // String-to-number converters with automatic warning generation
+ class Converter_strntod_with_warn: public Converter_strntod
+ {
+ public:
+ Converter_strntod_with_warn(THD *thd, Warn_filter filter,
+ CHARSET_INFO *cs,
+ const char *str, size_t length)
+ :Converter_strntod(cs, str, length)
+ {
+ check_edom_and_truncation(thd, filter, "DOUBLE", cs, str, length);
+ }
+ };
+
+ class Converter_strntoll_with_warn: public Converter_strntoll
+ {
+ public:
+ Converter_strntoll_with_warn(THD *thd, Warn_filter filter,
+ CHARSET_INFO *cs,
+ const char *str, size_t length)
+ :Converter_strntoll(cs, str, length)
+ {
+ check_edom_and_truncation(thd, filter, "INTEGER", cs, str, length);
+ }
+ };
+
+ class Converter_strtoll10_with_warn: public Converter_strtoll10
+ {
+ public:
+ Converter_strtoll10_with_warn(THD *thd, Warn_filter filter,
+ CHARSET_INFO *cs,
+ const char *str, size_t length)
+ :Converter_strtoll10(cs, str, length)
+ {
+ check_edom_and_truncation(thd, filter, "INTEGER", cs, str, length);
+ }
+ };
+
+ class Converter_str2my_decimal_with_warn: public Converter_str2my_decimal
+ {
+ public:
+ Converter_str2my_decimal_with_warn(THD *thd, Warn_filter filter,
+ uint mask, CHARSET_INFO *cs,
+ const char *str, size_t length,
+ my_decimal *buf)
+ :Converter_str2my_decimal(mask, cs, str, length, buf)
+ {
+ check_edom_and_truncation(thd, filter, "DECIMAL", cs, str, length);
+ }
+ };
+
+
+ // String-to-number convertion methods for the old code compatibility
+ longlong longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
+ const char *end) const
+ {
+ /*
+ TODO: Give error if we wanted a signed integer and we got an unsigned
+ one
+
+ Notice, longlong_from_string_with_check() honors thd->no_error, because
+ it's used to handle queries like this:
+ SELECT COUNT(@@basedir);
+ and is called when Item_func_get_system_var::update_null_value()
+ suppresses warnings and then calls val_int().
+ The other methods {double|decimal}_from_string_with_check() ignore
+ thd->no_errors, because they are not used for update_null_value()
+ and they always allow all kind of warnings.
+ */
+ THD *thd= current_thd;
+ return Converter_strtoll10_with_warn(thd, Warn_filter(thd),
+ cs, cptr, end - cptr).result();
+ }
+
+ double double_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
+ const char *end) const
+ {
+ return Converter_strntod_with_warn(NULL, Warn_filter_all(),
+ cs, cptr, end - cptr).result();
+ }
+ my_decimal *decimal_from_string_with_check(my_decimal *decimal_value,
+ CHARSET_INFO *cs,
+ const char *cptr,
+ const char *end)
+ {
+ Converter_str2my_decimal_with_warn(NULL, Warn_filter_all(),
+ E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
+ cs, cptr, end - cptr, decimal_value);
+ return decimal_value;
+ }
+ // End of String-to-number conversion methods
+
public:
/*
The enumeration Subst_constraint is currently used only in implementations
@@ -1207,6 +1432,20 @@ protected:
class Field_num :public Field {
protected:
+ int check_edom_and_truncation(const char *type, bool edom,
+ CHARSET_INFO *cs,
+ const char *str, uint length,
+ const char *end_of_num);
+ int check_int(CHARSET_INFO *cs, const char *str, uint length,
+ const char *int_end, int error)
+ {
+ return check_edom_and_truncation("integer",
+ error == MY_ERRNO_EDOM || str == int_end,
+ cs, str, length, int_end);
+ }
+ bool get_int(CHARSET_INFO *cs, const char *from, uint len,
+ longlong *rnd, ulonglong unsigned_max,
+ longlong signed_min, longlong signed_max);
void prepend_zeros(String *value) const;
Item *get_equal_zerofill_const_item(THD *thd, const Context &ctx,
Item *const_item);
@@ -1244,11 +1483,6 @@ public:
return length;
}
int store_time_dec(MYSQL_TIME *ltime, uint dec);
- int check_int(CHARSET_INFO *cs, const char *str, int length,
- const char *int_end, int error);
- bool get_int(CHARSET_INFO *cs, const char *from, uint len,
- longlong *rnd, ulonglong unsigned_max,
- longlong signed_min, longlong signed_max);
double pos_in_interval(Field *min, Field *max)
{
return pos_in_interval_val_real(min, max);
@@ -1318,9 +1552,6 @@ protected:
const Item *item) const;
bool cmp_to_string_with_stricter_collation(const Item_bool_func *cond,
const Item *item) const;
- my_decimal *val_decimal_from_str(const char *str, uint length,
- CHARSET_INFO *cs,
- my_decimal *decimal_value);
public:
Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
@@ -1342,6 +1573,8 @@ public:
/* base class for float and double and decimal (old one) */
class Field_real :public Field_num {
+protected:
+ double get_double(const char *str, uint length, CHARSET_INFO *cs, int *err);
public:
bool not_fixed;
@@ -2485,6 +2718,11 @@ new_Field_datetime(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit,
}
class Field_string :public Field_longstr {
+ class Warn_filter_string: public Warn_filter
+ {
+ public:
+ Warn_filter_string(const THD *thd, const Field_string *field);
+ };
public:
bool can_alter_field_type;
Field_string(uchar *ptr_arg, uint32 len_arg,uchar *null_ptr_arg,
@@ -2558,6 +2796,14 @@ private:
class Field_varstring :public Field_longstr {
+ uchar *get_data() const
+ {
+ return ptr + length_bytes;
+ }
+ uint get_length() const
+ {
+ return length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
+ }
public:
/*
The maximum space available in a Field_varstring, in bytes. See
diff --git a/sql/item.cc b/sql/item.cc
index 6ae6fc87bf7..55159cb9df0 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -317,18 +317,8 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
if (!(res= val_str(&str_value)))
return 0;
- if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
- res->ptr(), res->length(), res->charset(),
- decimal_value) & E_DEC_BAD_NUM)
- {
- THD *thd= current_thd;
- ErrConvString err(res);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), "DECIMAL",
- err.ptr());
- }
- return decimal_value;
+ return decimal_from_string_with_check(decimal_value,
+ res->charset(), res->ptr(), res->end());
}
@@ -3028,33 +3018,6 @@ void Item_string::print(String *str, enum_query_type query_type)
}
-double
-double_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
- const char *end)
-{
- int error;
- char *end_of_num= (char*) end;
- double tmp;
-
- tmp= my_strntod(cs, (char*) cptr, end - cptr, &end_of_num, &error);
- if (error || (end != end_of_num &&
- !check_if_only_end_space(cs, end_of_num, end)))
- {
- THD *thd= current_thd;
- ErrConvString err(cptr, end - cptr, cs);
- /*
- We can use err.ptr() here as ErrConvString is guranteed to put an
- end \0 here.
- */
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), "DOUBLE",
- err.ptr());
- }
- return tmp;
-}
-
-
double Item_string::val_real()
{
DBUG_ASSERT(fixed == 1);
@@ -3065,34 +3028,6 @@ double Item_string::val_real()
}
-longlong
-longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
- const char *end)
-{
- int err;
- longlong tmp;
- char *end_of_num= (char*) end;
- THD *thd= current_thd;
-
- tmp= (*(cs->cset->strtoll10))(cs, cptr, &end_of_num, &err);
- /*
- TODO: Give error if we wanted a signed integer and we got an unsigned
- one
- */
- if (!thd->no_errors &&
- (err > 0 ||
- (end != end_of_num && !check_if_only_end_space(cs, end_of_num, end))))
- {
- ErrConvString err_str(cptr, end - cptr, cs);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), "INTEGER",
- err_str.ptr());
- }
- return tmp;
-}
-
-
/**
@todo
Give error if we wanted a signed integer and we got an unsigned one
diff --git a/sql/item.h b/sql/item.h
index 6a4e5481b36..2b845064dce 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3043,13 +3043,6 @@ public:
};
-longlong
-longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
- const char *end);
-double
-double_from_string_with_check(CHARSET_INFO *cs, const char *cptr,
- const char *end);
-
class Item_static_string_func :public Item_string
{
const char *func_name;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index bc4a39b577b..e0cfa037780 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1137,11 +1137,8 @@ void Item_func_signed::print(String *str, enum_query_type query_type)
longlong Item_func_signed::val_int_from_str(int *error)
{
- char buff[MAX_FIELD_WIDTH], *end, *start;
- uint32 length;
+ char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff), &my_charset_bin), *res;
- longlong value;
- CHARSET_INFO *cs;
/*
For a string result, we must first get the string and then convert it
@@ -1155,22 +1152,10 @@ longlong Item_func_signed::val_int_from_str(int *error)
return 0;
}
null_value= 0;
- start= (char *)res->ptr();
- length= res->length();
- cs= res->charset();
-
- end= start + length;
- value= cs->cset->strtoll10(cs, start, &end, error);
- if (*error > 0 || end != start+ length)
- {
- THD *thd= current_thd;
- ErrConvString err(res);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_TRUNCATED_WRONG_VALUE,
- ER_THD(thd, ER_TRUNCATED_WRONG_VALUE), "INTEGER",
- err.ptr());
- }
- return value;
+ Converter_strtoll10_with_warn cnv(NULL, Warn_filter_all(),
+ res->charset(), res->ptr(), res->length());
+ *error= cnv.error();
+ return cnv.result();
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 7f466e86afb..ef2e96e8234 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -5081,13 +5081,15 @@ my_decimal *Item_dyncol_get::val_decimal(my_decimal *decimal_value)
break;
case DYN_COL_STRING:
{
+ const char *end;
int rc;
rc= str2my_decimal(0, val.x.string.value.str, val.x.string.value.length,
- val.x.string.charset, decimal_value);
+ val.x.string.charset, decimal_value, &end);
char buff[80];
strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1,
val.x.string.value.length));
- if (rc != E_DEC_OK)
+ if (rc != E_DEC_OK ||
+ end != val.x.string.value.str + val.x.string.value.length)
{
THD *thd= current_thd;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 5ec3fe7ff28..91455c7cb84 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -239,9 +239,9 @@ int my_decimal2binary(uint mask, const my_decimal *d, uchar *bin, int prec,
*/
int str2my_decimal(uint mask, const char *from, uint length,
- CHARSET_INFO *charset, my_decimal *decimal_value)
+ CHARSET_INFO *charset, my_decimal *decimal_value,
+ const char **end_ptr)
{
- char *end, *from_end;
int err;
char buff[STRING_BUFFER_USUAL_SIZE];
String tmp(buff, sizeof(buff), &my_charset_bin);
@@ -253,20 +253,11 @@ int str2my_decimal(uint mask, const char *from, uint length,
length= tmp.length();
charset= &my_charset_bin;
}
- from_end= end= (char*) from+length;
+ char *end= (char*) from + length;
err= string2decimal((char *)from, (decimal_t*) decimal_value, &end);
- if (end != from_end && !err)
- {
- /* Give warning if there is something other than end space */
- for ( ; end < from_end; end++)
- {
- if (!my_isspace(&my_charset_latin1, *end))
- {
- err= E_DEC_TRUNCATED;
- break;
- }
- }
- }
+ if (charset->mbminlen > 1)
+ end= (char *) from + charset->mbminlen * (size_t) (end - buff);
+ *end_ptr= end;
check_result_and_overflow(mask, err, decimal_value);
return err;
}
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index a2cce862f1a..78c71d54b6d 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -366,13 +366,23 @@ int str2my_decimal(uint mask, const char *str, my_decimal *d, char **end)
int str2my_decimal(uint mask, const char *from, uint length,
- CHARSET_INFO *charset, my_decimal *decimal_value);
+ CHARSET_INFO *charset, my_decimal *decimal_value,
+ const char **end);
+
+inline int str2my_decimal(uint mask, const char *from, uint length,
+ CHARSET_INFO *charset, my_decimal *decimal_value)
+{
+ const char *end;
+ return str2my_decimal(mask, from, length, charset, decimal_value, &end);
+}
#if defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
inline
int string2my_decimal(uint mask, const String *str, my_decimal *d)
{
- return str2my_decimal(mask, str->ptr(), str->length(), str->charset(), d);
+ const char *end;
+ return str2my_decimal(mask, str->ptr(), str->length(), str->charset(),
+ d, &end);
}
diff --git a/sql/set_var.h b/sql/set_var.h
index 43ad7f509d8..b8192e67ca9 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -55,7 +55,7 @@ int mysql_del_sys_var_chain(sys_var *chain);
optionally it can be assigned to, optionally it can have a command-line
counterpart with the same name.
*/
-class sys_var
+class sys_var: protected Value_source // for double_from_string_with_check
{
public:
sys_var *next;
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
index 5d271bc73fa..faeba12736d 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_decimal.result
@@ -182,7 +182,7 @@ Note 1265 Data truncated for column 'a' at row 3
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -247,7 +247,7 @@ Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -306,7 +306,7 @@ Note 1265 Data truncated for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
-Note 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
@@ -359,6 +359,9 @@ insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings:
Note 1265 Data truncated for column 'a' at row 3
insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 ");
+Warnings:
+Note 1265 Data truncated for column 'a' at row 2
+Note 1265 Data truncated for column 'a' at row 3
select * from t1;
a
0.00
diff --git a/storage/tokudb/mysql-test/tokudb/r/type_varchar.result b/storage/tokudb/mysql-test/tokudb/r/type_varchar.result
index ad95b9a9908..4cd1b0abb87 100644
--- a/storage/tokudb/mysql-test/tokudb/r/type_varchar.result
+++ b/storage/tokudb/mysql-test/tokudb/r/type_varchar.result
@@ -469,6 +469,7 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's'
+Warning 1292 Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), ('');
@@ -479,4 +480,5 @@ SELECT 5 = a FROM t1;
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's '
+Warning 1292 Truncated incorrect DOUBLE value: ' '
DROP TABLE t1;
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 020bfd0035a..288f5fdd49d 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1619,7 +1619,10 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */
if ((negative_exp= (*str == '-')) || *str=='+')
{
if (++str == end)
+ {
+ str-= 2; /* 'e-' or 'e+' not followed by digits */
goto ret_sign;
+ }
}
for (exponent= 0 ;
str < end && (ch= (uchar) (*str - '0')) < 10;
@@ -1629,6 +1632,8 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */
}
shift+= negative_exp ? -exponent : exponent;
}
+ else
+ str--; /* 'e' not followed by digits */
}
if (shift == 0) /* No shift, check addon digit */