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
This commit is contained in:
Alexander Barkov 2015-09-17 11:05:07 +04:00
parent c69cf93bfb
commit d9b25ae3db
60 changed files with 2779 additions and 390 deletions

View file

@ -49,5 +49,66 @@ col435
0.00000000000000000 0.00000000000000000
0.00000000000000000 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; set session sort_buffer_size= default;
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;

View file

@ -13,7 +13,7 @@ select CAST('10 ' as unsigned integer);
CAST('10 ' as unsigned integer) CAST('10 ' as unsigned integer)
10 10
Warnings: 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; select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1;
cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1 cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1
18446744073709551611 18446744073709551611 18446744073709551611 18446744073709551611

View file

@ -3345,12 +3345,18 @@ INSERT INTO t1 VALUES (' 1'),('`1');
SELECT * FROM t1 WHERE a IN (1,2,3); SELECT * FROM t1 WHERE a IN (1,2,3);
a a
1 1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1'; SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
a a
1 1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1'; SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1';
a a
1 1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 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 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 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where

View file

@ -1694,6 +1694,7 @@ DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1)
AS BINARY(0)) USING utf8); AS BINARY(0)) USING utf8);
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'Zpq' Warning 1292 Truncated incorrect INTEGER value: 'Zpq'
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect BINARY(0) value: '1.' Warning 1292 Truncated incorrect BINARY(0) value: '1.'
# #
# End of 5.1 tests # End of 5.1 tests

View file

@ -5340,7 +5340,7 @@ Warning 1292 Truncated incorrect INTEGER value: ''
CREATE TABLE t1 (a DECIMAL(2,0)); CREATE TABLE t1 (a DECIMAL(2,0));
SET sql_mode='strict_all_tables'; SET sql_mode='strict_all_tables';
INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2)); 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; SET sql_mode=DEFAULT;
INSERT INTO t1 VALUES (CONVERT('aaa' USING ucs2)); INSERT INTO t1 VALUES (CONVERT('aaa' USING ucs2));
Warnings: Warnings:

View file

@ -1254,6 +1254,8 @@ insert into t1 values ('-1234.1e2xxxx');
Warnings: Warnings:
Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 '); insert into t1 values ('-1234.1e2 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
select * from t1; select * from t1;
a a
-123410 -123410
@ -1262,6 +1264,8 @@ a
drop table t1; drop table t1;
create table t1 (a int); create table t1 (a int);
insert into t1 values ('1 '); insert into t1 values ('1 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
insert into t1 values ('1 x'); insert into t1 values ('1 x');
Warnings: Warnings:
Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'a' at row 1

View file

@ -1474,6 +1474,8 @@ INSERT INTO t1 VALUES ('-1234.1e2xxxx');
Warnings: Warnings:
Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('-1234.1e2 '); 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 ('123');
INSERT INTO t1 VALUES ('-124'); INSERT INTO t1 VALUES ('-124');
INSERT INTO t1 VALUES ('+125'); INSERT INTO t1 VALUES ('+125');
@ -1520,6 +1522,8 @@ DROP TABLE t1;
# #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES ('1 '); INSERT INTO t1 VALUES ('1 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
INSERT INTO t1 VALUES ('1 x'); INSERT INTO t1 VALUES ('1 x');
Warnings: Warnings:
Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'a' at row 1

View file

@ -1252,6 +1252,8 @@ insert into t1 values ('-1234.1e2xxxx');
Warnings: Warnings:
Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'a' at row 1
insert into t1 values ('-1234.1e2 '); insert into t1 values ('-1234.1e2 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
select * from t1; select * from t1;
a a
-123410 -123410
@ -1260,6 +1262,8 @@ a
drop table t1; drop table t1;
create table t1 (a int); create table t1 (a int);
insert into t1 values ('1 '); insert into t1 values ('1 ');
Warnings:
Note 1265 Data truncated for column 'a' at row 1
insert into t1 values ('1 x'); insert into t1 values ('1 x');
Warnings: Warnings:
Warning 1265 Data truncated for column 'a' at row 1 Warning 1265 Data truncated for column 'a' at row 1

View file

@ -10174,12 +10174,18 @@ INSERT INTO t1 VALUES ('1e1'),('1ë1');
SELECT * FROM t1 WHERE a IN (1,2); SELECT * FROM t1 WHERE a IN (1,2);
a a
1ë1 1ë1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1'; SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
a a
1ë1 1ë1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1ë1'
SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1'; SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1';
a a
1ë1 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'; 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 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 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where

View file

@ -73,6 +73,9 @@ set @@global.max_allowed_packet=1048576*100;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null; select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0 0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: XXX
Warning 1292 Truncated incorrect DOUBLE value: XXX
set @@global.max_allowed_packet=default; set @@global.max_allowed_packet=default;
create table t1(a blob); create table t1(a blob);
insert into t1 values(NULL), (compress('a')); insert into t1 values(NULL), (compress('a'));

View file

@ -476,8 +476,13 @@ CREATE TABLE t1(f1 LONGTEXT) engine=myisam;
INSERT INTO t1 VALUES ('a'); INSERT INTO t1 VALUES ('a');
SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a'; SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1 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'; SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a';
1 1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect INTEGER value: 'a'
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
SELECT 1e308 + 1e308; SELECT 1e308 + 1e308;

View file

@ -2893,6 +2893,8 @@ NULL
SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))); SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)));
((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))) ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)))
1 1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc)); SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
((0xf3) * (rpad(1.0,2048,1)) << (0xcc)) ((0xf3) * (rpad(1.0,2048,1)) << (0xcc))
0 0

View file

@ -1714,6 +1714,7 @@ min(timestampadd(month, 1>'', from_days('%Z')))
NULL NULL
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: '%Z' Warning 1292 Truncated incorrect INTEGER value: '%Z'
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Incorrect datetime value: '0000-00-00' Warning 1292 Incorrect datetime value: '0000-00-00'
create table t1(a time); create table t1(a time);
insert into t1 values ('00:00:00'),('00:01:00'); insert into t1 values ('00:00:00'),('00:01:00');

View file

@ -267,6 +267,8 @@ POLYGON
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER # 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)'),''); DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN( SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), 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))) '), 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))) '),

View file

@ -754,6 +754,8 @@ POLYGON
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER # 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)'),''); DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN( SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), 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))) '), 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))) '),

View file

@ -92,14 +92,14 @@ create table t1(number int auto_increment primary key, original_value varchar(50
set @value= "aa"; set @value= "aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings: Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1 Warning 1366 Incorrect double value: 'aa' for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1 Warning 1366 Incorrect double value: 'aa' for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1 Warning 1366 Incorrect double value: 'aa' for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1 Warning 1366 Incorrect double value: 'aa' for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1 Warning 1366 Incorrect double value: 'aa' for column 'f_double_u' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1 Warning 1366 Incorrect double value: 'aa' for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1 Warning 1366 Incorrect double value: 'aa' 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_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 1 number 1
original_value aa original_value aa
@ -136,14 +136,14 @@ f_float_3_1_u 1.0
set @value= "aa1"; set @value= "aa1";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings: Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1 Warning 1366 Incorrect double value: 'aa1' for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1 Warning 1366 Incorrect double value: 'aa1' for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1 Warning 1366 Incorrect double value: 'aa1' for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1 Warning 1366 Incorrect double value: 'aa1' for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1 Warning 1366 Incorrect double value: 'aa1' for column 'f_double_u' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1 Warning 1366 Incorrect double value: 'aa1' for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1 Warning 1366 Incorrect double value: 'aa1' 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_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 3 number 3
original_value aa1 original_value aa1

View file

@ -43,8 +43,11 @@ drop table t1;
create table t1 (a int, b char(10)); 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; load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings: 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 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 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 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 Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from t1; select * from t1;
@ -57,6 +60,9 @@ a b
truncate table t1; truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings: 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: ' Warning 1366 Incorrect integer value: '
' for column 'a' at row 4 ' for column 'a' at row 4
Warning 1261 Row 4 doesn't contain data for all columns Warning 1261 Row 4 doesn't contain data for all columns
@ -73,6 +79,8 @@ insert into t1 values(0);
select * from t1; select * from t1;
id id
0 0
Warnings:
Note 1265 Data truncated for column 'id' at row 1
select * from t1; select * from t1;
id id
0 0
@ -180,6 +188,13 @@ NULL 10 10
NULL 15 15 NULL 15 15
truncate table t1; truncate table t1;
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow"; 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; select * from t1;
a b c a b c
1 2 Wow 1 2 Wow
@ -187,6 +202,13 @@ a b c
5 6 Wow 5 6 Wow
truncate table t1; 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)); 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; select * from t1;
a b c a b c
1 2 1+2+123+2+NIL 1 2 1+2+123+2+NIL
@ -234,7 +256,9 @@ f1
2 2
delete from t1; delete from t1;
Warnings: Warnings:
Note 1265 Data truncated for column 'f1' at row 1
Warning 1261 Row 1 doesn't contain data for all columns 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 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; select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
f1 f1

View file

@ -1758,7 +1758,7 @@ CAST('10 ' as unsigned integer)
CAST('10 ' as unsigned integer) CAST('10 ' as unsigned integer)
10 10
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 ' Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP PROCEDURE p2; DROP PROCEDURE p2;
@ -1767,7 +1767,7 @@ DROP PROCEDURE p2;
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
DECLARE c INT DEFAULT 0; 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 p2();
CALL p3(); CALL p3();
CALL p4(); CALL p4();
@ -1797,7 +1797,7 @@ END|
CREATE PROCEDURE P6() CREATE PROCEDURE P6()
BEGIN BEGIN
DECLARE c INT DEFAULT 0; 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(); CALL p5();
SELECT c; SELECT c;
END| END|
@ -1821,7 +1821,7 @@ CALL p6();
CAST('10 ' as unsigned integer) CAST('10 ' as unsigned integer)
10 10
Level Code Message Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '10 ' Note 1292 Truncated incorrect INTEGER value: '10 '
c c
1 1
DROP PROCEDURE p1; 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 'x' at row 1
Warning 1264 Out of range value for column 'y' 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 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 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 Warning 1264 Out of range value for column 'b' at row 1
Error 1048 Column 'c' cannot be null Error 1048 Column 'c' cannot be null
@ -2744,14 +2744,14 @@ END|
CALL p6()| CALL p6()|
Level Code Message Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '1 ' Note 1292 Truncated incorrect INTEGER value: '1 '
Warning 1292 Truncated incorrect INTEGER value: '1999999 ' Note 1292 Truncated incorrect INTEGER value: '1999999 '
Warning 1264 Out of range value for column 'a' at row 1 Warning 1264 Out of range value for column 'a' at row 1
Warning 1292 Truncated incorrect INTEGER value: '2 ' Note 1292 Truncated incorrect INTEGER value: '2 '
Warning 1292 Truncated incorrect INTEGER value: '2999999 ' Note 1292 Truncated incorrect INTEGER value: '2999999 '
Warning 1264 Out of range value for column 'b' at row 1 Warning 1264 Out of range value for column 'b' at row 1
Warning 1292 Truncated incorrect INTEGER value: '3 ' Note 1292 Truncated incorrect INTEGER value: '3 '
Warning 1292 Truncated incorrect INTEGER value: '3999999 ' Note 1292 Truncated incorrect INTEGER value: '3999999 '
Warning 1264 Out of range value for column 'c' at row 1 Warning 1264 Out of range value for column 'c' at row 1
Msg Msg
Handler for 1292 Handler for 1292

View file

@ -7102,7 +7102,7 @@ CAST('10 ' as UNSIGNED INTEGER)
1 1
Warnings: Warnings:
Warning 1265 Data truncated for column 'a' at row 1 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 p1;
DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2; DROP PROCEDURE IF EXISTS p2;
@ -7128,7 +7128,7 @@ CAST('10 ' as UNSIGNED INTEGER)
2 2
2 2
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 ' Note 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP PROCEDURE p2; DROP PROCEDURE p2;
DROP PROCEDURE p3; DROP PROCEDURE p3;

View file

@ -778,7 +778,7 @@ ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E+1'); INSERT INTO t1 VALUES ('-100E+1');
ERROR 22003: Out of range value for column 'col1' at row 1 ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 VALUES ('-100E'); 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; UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
ERROR 22003: Out of range value for column 'col1' at row 6 ERROR 22003: Out of range value for column 'col1' at row 6
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0; 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'); INSERT INTO t1 (col1) VALUES ('a59b');
ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1 ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a'); 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'); INSERT IGNORE INTO t1 (col1) VALUES ('2a');
Warnings: 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); INSERT IGNORE INTO t1 values (1/0);
Warnings: Warnings:
Warning 1365 Division by 0 Warning 1365 Division by 0
@ -853,9 +853,9 @@ ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES (''); 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'); 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'); INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1 ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a'); 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; UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES (''); 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'); 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'); INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1 ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a'); 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 unsigned integer));
insert into t1 (col2) values (cast('10' as signed integer)); insert into t1 (col2) values (cast('10' as signed integer));
insert into t1 (col2) values (10E+0 + '0 '); insert into t1 (col2) values (10E+0 + '0 ');
Warnings:
Note 1292 Truncated incorrect DOUBLE value: '0 '
select * from t1; select * from t1;
col1 col2 col1 col2
NULL 10 NULL 10

View file

@ -6312,12 +6312,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b ORDER BY b
); );
1 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 t1 WHERE a =
(SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b GROUP BY b
); );
1 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; DROP TABLE t1, t2;
# #
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View file

@ -6312,12 +6312,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b ORDER BY b
); );
1 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 t1 WHERE a =
(SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b GROUP BY b
); );
1 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; DROP TABLE t1, t2;
# #
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View file

@ -6307,12 +6307,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b ORDER BY b
); );
1 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 t1 WHERE a =
(SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b GROUP BY b
); );
1 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; DROP TABLE t1, t2;
# #
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View file

@ -6303,12 +6303,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b ORDER BY b
); );
1 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 t1 WHERE a =
(SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b GROUP BY b
); );
1 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; DROP TABLE t1, t2;
# #
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View file

@ -6318,12 +6318,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b ORDER BY b
); );
1 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 t1 WHERE a =
(SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b GROUP BY b
); );
1 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; DROP TABLE t1, t2;
# #
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View file

@ -6303,12 +6303,22 @@ SELECT 1 FROM t1 WHERE a =
ORDER BY b ORDER BY b
); );
1 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 t1 WHERE a =
(SELECT 1 FROM t2 WHERE b = (SELECT 1 FROM t2 WHERE b =
(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2) (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
GROUP BY b GROUP BY b
); );
1 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; DROP TABLE t1, t2;
# #
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS) # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)

View file

@ -415,6 +415,13 @@ i j k @b
15 NULL 15 Fired 15 NULL 15 Fired
set @b:=""; set @b:="";
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j); 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; select *, @b from t1;
i j k @b i j k @b
10 NULL 10 Fired 10 NULL 10 Fired

View file

@ -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 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"); insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings: 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 Note 1265 Data truncated for column 'a' at row 3
select * from t1; select * from t1;
a 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 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"); insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings: 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 Note 1265 Data truncated for column 'a' at row 3
select * from t1; select * from t1;
a 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 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"); insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings: 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 Note 1265 Data truncated for column 'a' at row 3
select * from t1; select * from t1;
a a
@ -358,6 +358,9 @@ insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings: Warnings:
Note 1265 Data truncated for column 'a' at row 3 Note 1265 Data truncated for column 'a' at row 3
insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 "); 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; select * from t1;
a a
0.00 0.00

View file

@ -458,7 +458,7 @@ Warnings:
Warning 1265 Data truncated for column 'f' at row 1 Warning 1265 Data truncated for column 'f' at row 1
INSERT INTO t1 VALUES ('.'); INSERT INTO t1 VALUES ('.');
Warnings: 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; SELECT * FROM t1 ORDER BY f;
f f
0 0

1222
mysql-test/r/type_num.result Normal file

File diff suppressed because it is too large Load diff

View file

@ -499,6 +499,7 @@ SELECT 5 = a FROM t1;
0 0
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's' Warning 1292 Truncated incorrect DOUBLE value: 's'
Warning 1292 Truncated incorrect DOUBLE value: ''
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a CHAR(16)); CREATE TABLE t1 (a CHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), (''); INSERT INTO t1 VALUES ('5'), ('s'), ('');
@ -509,6 +510,7 @@ SELECT 5 = a FROM t1;
0 0
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's ' Warning 1292 Truncated incorrect DOUBLE value: 's '
Warning 1292 Truncated incorrect DOUBLE value: ' '
DROP TABLE t1; DROP TABLE t1;
# #
# Start of 10.0 tests # Start of 10.0 tests

View file

@ -175,6 +175,8 @@ b'' 0+b''
select x'', 0+x''; select x'', 0+x'';
x'' 0+x'' x'' 0+x''
0 0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
select 0x; select 0x;
ERROR 42S22: Unknown column '0x' in 'field list' ERROR 42S22: Unknown column '0x' in 'field list'
select 0b; select 0b;

View file

@ -1350,8 +1350,11 @@ a b
delete from t1; delete from t1;
load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings: 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 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1369 CHECK OPTION failed 'test.v1' 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 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4
Warning 1369 CHECK OPTION failed 'test.v1' Warning 1369 CHECK OPTION failed 'test.v1'
select * from t1 order by a,b; 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; CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM t1 WHERE a <> 0 AND a = ' 1'; SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
a a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM v1 WHERE a <> 0 AND a = ' 1'; SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
a a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a ENUM('5','6')); 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; CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM t1 WHERE a <> 0 AND a = ' 1'; SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
a a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
SELECT * FROM v1 WHERE a <> 0 AND a = ' 1'; SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
a a
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '`1'
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a ENUM('5','6')); CREATE TABLE t1 (a ENUM('5','6'));

View file

@ -1161,6 +1161,8 @@ SET NAMES latin1;
SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0); SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0) UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0)
NULL NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
# #
# Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS # Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS
# #

View file

@ -4818,7 +4818,14 @@ LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2) INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow'; SET c3 = 'Wow';
affected rows: 3 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. # Show what we have in the table.
# #

View file

@ -4857,7 +4857,14 @@ LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2) INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow'; SET c3 = 'Wow';
affected rows: 3 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. # Show what we have in the table.
# #

View file

@ -1689,6 +1689,11 @@ a b c
19 23 437 19 23 437
delete from federated.t1; 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); 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; select * from federated.t1 order by a;
a b c a b c
3 4 12 3 4 12

View file

@ -2098,8 +2098,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' 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; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection 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 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 NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' 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; DROP VIEW v1;
@ -2166,8 +2168,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection 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 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 NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;
@ -2198,6 +2202,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
@ -2213,6 +2218,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;

View file

@ -2099,8 +2099,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' 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; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection 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 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 NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' 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; DROP VIEW v1;
@ -2167,8 +2169,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection 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 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 NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;
@ -2199,6 +2203,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
@ -2214,6 +2219,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;

View file

@ -2099,8 +2099,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' 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; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection 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 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 NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' 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; DROP VIEW v1;
@ -2167,8 +2169,9 @@ IS NOT TRUE <---------1000 characters-------------------------------------------
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection 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 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 NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;
@ -2199,6 +2203,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
@ -2214,6 +2219,7 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' '
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- '
DROP VIEW v1; DROP VIEW v1;

View file

@ -13870,7 +13870,7 @@ CALL sp1();
xx xx
0 0
Warnings: 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; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
BEGIN BEGIN

View file

@ -46,12 +46,22 @@ drop table t1;
create table t1 (pk int primary key, apk int unique, data int) engine=aria; 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); 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); 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; select * from t1 order by pk;
pk apk data pk apk data
1 1 1 1 1 1
3 4 NULL 3 4 NULL
5 6 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); 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; select * from t1 order by pk;
pk apk data pk apk data
1 1 1 1 1 1

View file

@ -247,6 +247,8 @@ UNLOCK TABLES;
select * from `table5` where (col2 <= '6566-06-15' AND col24 <> 'd') group by `col83` order by `col83` desc ; 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 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: Warnings:
Warning 1366 Incorrect decimal value: 'd' for column 'col24' at row 1 Warning 1292 Truncated incorrect DOUBLE value: 'd'
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'
drop table `table5`; drop table `table5`;

View file

@ -63,8 +63,11 @@ drop table t1;
create table t1 (a int, b char(10)); 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; load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings: 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 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 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 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 Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from rewrite.t1; select * from rewrite.t1;
@ -77,6 +80,9 @@ a b
truncate table t1; truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines; load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings: 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: ' Warning 1366 Incorrect integer value: '
' for column 'a' at row 4 ' for column 'a' at row 4
Warning 1261 Row 4 doesn't contain data for all columns Warning 1261 Row 4 doesn't contain data for all columns

View file

@ -882,7 +882,7 @@ DO CAST(CONVERT('' USING ucs2) AS UNSIGNED);
CREATE TABLE t1 (a DECIMAL(2,0)); CREATE TABLE t1 (a DECIMAL(2,0));
SET sql_mode='strict_all_tables'; 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)); INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2));
SET sql_mode=DEFAULT; SET sql_mode=DEFAULT;

View file

@ -2606,7 +2606,7 @@ delimiter |;
CREATE PROCEDURE p1() CREATE PROCEDURE p1()
BEGIN BEGIN
DECLARE c INT DEFAULT 0; 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 p2();
CALL p3(); CALL p3();
CALL p4(); CALL p4();
@ -2641,7 +2641,7 @@ CREATE PROCEDURE p5()
CREATE PROCEDURE P6() CREATE PROCEDURE P6()
BEGIN BEGIN
DECLARE c INT DEFAULT 0; 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(); CALL p5();
SELECT c; SELECT c;
END| END|

View file

@ -750,7 +750,7 @@ INSERT INTO t1 VALUES ('-101.55');
INSERT INTO t1 VALUES ('-1010.55'); INSERT INTO t1 VALUES ('-1010.55');
--error 1264 --error 1264
INSERT INTO t1 VALUES ('-100E+1'); INSERT INTO t1 VALUES ('-100E+1');
--error 1366 --error WARN_DATA_TRUNCATED
INSERT INTO t1 VALUES ('-100E'); INSERT INTO t1 VALUES ('-100E');
--error 1264 --error 1264
UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11; UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
@ -764,7 +764,7 @@ INSERT INTO t1 (col1) VALUES ('');
#--error 1265 #--error 1265
--error 1366 --error 1366
INSERT INTO t1 (col1) VALUES ('a59b'); INSERT INTO t1 (col1) VALUES ('a59b');
--error 1366 --error WARN_DATA_TRUNCATED
INSERT INTO t1 (col1) VALUES ('1a'); INSERT INTO t1 (col1) VALUES ('1a');
INSERT IGNORE INTO t1 (col1) VALUES ('2a'); INSERT IGNORE INTO t1 (col1) VALUES ('2a');
INSERT IGNORE INTO t1 values (1/0); 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; UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365 --error 1365
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
--error 1265 --error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
--error 1265 --error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('a59b'); INSERT INTO t1 (col1) VALUES ('a59b');
--error 1265 --error 1265
INSERT INTO t1 (col1) VALUES ('1a'); 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; UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365 --error 1365
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
--error 1265 --error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES (''); INSERT INTO t1 (col1) VALUES ('');
--error 1265 --error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 (col1) VALUES ('a59b'); INSERT INTO t1 (col1) VALUES ('a59b');
--error 1265 --error 1265
INSERT INTO t1 (col1) VALUES ('1a'); INSERT INTO t1 (col1) VALUES ('1a');

683
mysql-test/t/type_num.test Normal file
View file

@ -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 #

View file

@ -1054,37 +1054,6 @@ Item_result Field::result_merge_type(enum_field_types field_type)
Static help functions Static help functions
*****************************************************************************/ *****************************************************************************/
/**
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. Check whether a field type can be partially indexed by a key.
@ -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 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 @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 @retval
0 OK 0 OK
@retval @retval
1 error: empty string or wrong integer. 1 error: could not scan any digits (EDOM),
e.g. empty string, or garbage.
@retval @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 */ /* Test if we get an empty string or garbage */
if (str == int_end || error == MY_ERRNO_EDOM) if (edom)
{ {
ErrConvString err(str, length, cs); ErrConvString err(str, length, cs);
set_warning_truncated_wrong_value("integer", err.ptr()); set_warning_truncated_wrong_value(type, err.ptr());
return 1; return 1;
} }
/* Test if we have garbage at the end of the given string. */ /* 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); set_warning(WARN_DATA_TRUNCATED, 1);
return 2; return 2;
} }
if (end < str + length)
set_note(WARN_DATA_TRUNCATED, 1);
return 0; 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 Process decimal library return codes and issue warnings for overflow and
truncation. truncation.
@ -2962,36 +3038,60 @@ int Field_new_decimal::store(const char *from, uint length,
CHARSET_INFO *charset_arg) CHARSET_INFO *charset_arg)
{ {
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED; ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int err;
my_decimal decimal_value; my_decimal decimal_value;
THD *thd= get_thd();
DBUG_ENTER("Field_new_decimal::store(char*)"); DBUG_ENTER("Field_new_decimal::store(char*)");
if ((err= str2my_decimal(E_DEC_FATAL_ERROR & const char *end;
~(E_DEC_OVERFLOW | E_DEC_BAD_NUM), int err= str2my_decimal(E_DEC_FATAL_ERROR &
~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
from, length, charset_arg, from, length, charset_arg,
&decimal_value)) && &decimal_value, &end);
get_thd()->abort_on_warning)
if (err == E_DEC_OVERFLOW) // Too many digits (>81) in the integer part
{ {
ErrConvString errmsg(from, length, charset_arg); set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
set_warning_truncated_wrong_value("decimal", errmsg.ptr()); if (!thd->abort_on_warning)
DBUG_RETURN(err); {
set_value_on_overflow(&decimal_value, decimal_value.sign());
store_decimal(&decimal_value);
}
DBUG_RETURN(1);
} }
switch (err) { if (thd->count_cuted_fields)
case E_DEC_TRUNCATED: {
set_note(WARN_DATA_TRUNCATED, 1); if (check_edom_and_truncation("decimal",
break; err && err != E_DEC_TRUNCATED,
case E_DEC_OVERFLOW: charset_arg, from, length, end))
set_warning(ER_WARN_DATA_OUT_OF_RANGE, 1);
set_value_on_overflow(&decimal_value, decimal_value.sign());
break;
case E_DEC_BAD_NUM:
{ {
ErrConvString errmsg(from, length, charset_arg); if (!thd->abort_on_warning)
set_warning_truncated_wrong_value("decimal", errmsg.ptr()); {
my_decimal_set_zero(&decimal_value); if (err && err != E_DEC_TRUNCATED)
break; {
/*
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 #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))); dbug_decimal_as_string(dbug_buff, &decimal_value)));
#endif #endif
store_value(&decimal_value); 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 Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
{ {
int error; int error;
char *end; Field_float::store(get_double(from, len, cs, &error));
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);
return 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 Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
{ {
int error; int error;
char *end; Field_double::store(get_double(from, len, cs, &error));
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);
return 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) double Field_string::val_real(void)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
int error;
char *end;
CHARSET_INFO *cs= charset();
double result;
THD *thd= get_thd(); THD *thd= get_thd();
return Converter_strntod_with_warn(get_thd(),
result= my_strntod(cs,(char*) ptr,field_length,&end,&error); Warn_filter_string(thd, this),
if (!thd->no_errors && Field_string::charset(),
(error || (field_length != (uint32)(end - (char*) ptr) && (const char *) ptr,
!check_if_only_end_space(cs, end, field_length).result();
(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;
} }
longlong Field_string::val_int(void) longlong Field_string::val_int(void)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
int error;
char *end;
CHARSET_INFO *cs= charset();
longlong result;
THD *thd= get_thd(); THD *thd= get_thd();
return Converter_strntoll_with_warn(thd, Warn_filter_string(thd, this),
result= my_strntoll(cs, (char*) ptr,field_length,10,&end,&error); Field_string::charset(),
if (!thd->no_errors && (const char *) ptr,
(error || (field_length != (uint32)(end - (char*) ptr) && field_length).result();
!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;
} }
@ -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) my_decimal *Field_string::val_decimal(my_decimal *decimal_value)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
return val_decimal_from_str((const char *) ptr, field_length, THD *thd= get_thd();
Field_string::charset(), decimal_value); 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) double Field_varstring::val_real(void)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
int error; THD *thd= get_thd();
char *end; return Converter_strntod_with_warn(thd, Warn_filter(thd),
double result; Field_varstring::charset(),
CHARSET_INFO* cs= charset(); (const char *) get_data(),
get_length()).result();
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;
} }
longlong Field_varstring::val_int(void) longlong Field_varstring::val_int(void)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
int error; THD *thd= get_thd();
char *end; return Converter_strntoll_with_warn(thd, Warn_filter(thd),
CHARSET_INFO *cs= charset(); Field_varstring::charset(),
(const char *) get_data(),
uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); get_length()).result();
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;
} }
String *Field_varstring::val_str(String *val_buffer __attribute__((unused)), String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr) String *val_ptr)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); val_ptr->set((const char*) get_data(), get_length(), field_charset);
val_ptr->set((const char*) ptr+length_bytes, length, field_charset);
return val_ptr; 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) my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); THD *thd= get_thd();
return val_decimal_from_str((const char *) ptr + length_bytes, length, Converter_str2my_decimal_with_warn(thd, Warn_filter(thd),
Field_varstring::charset(), decimal_value); 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) double Field_blob::val_real(void)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
int not_used; char *blob;
char *end_not_used, *blob;
uint32 length;
CHARSET_INFO *cs;
memcpy(&blob, ptr+packlength, sizeof(char*)); memcpy(&blob, ptr+packlength, sizeof(char*));
if (!blob) if (!blob)
return 0.0; return 0.0;
length= get_length(ptr); THD *thd= get_thd();
cs= charset(); return Converter_strntod_with_warn(thd, Warn_filter(thd),
return my_strntod(cs, blob, length, &end_not_used, &not_used); Field_blob::charset(),
blob, get_length(ptr)).result();
} }
longlong Field_blob::val_int(void) longlong Field_blob::val_int(void)
{ {
ASSERT_COLUMN_MARKED_FOR_READ; ASSERT_COLUMN_MARKED_FOR_READ;
int not_used;
char *blob; char *blob;
memcpy(&blob, ptr+packlength, sizeof(char*)); memcpy(&blob, ptr+packlength, sizeof(char*));
if (!blob) if (!blob)
return 0; return 0;
uint32 length=get_length(ptr); THD *thd= get_thd();
return my_strntoll(charset(),blob,length,10,NULL,&not_used); 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 *Field_blob::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr) String *val_ptr)
{ {
@ -7875,8 +7914,12 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
else else
length= get_length(ptr); length= get_length(ptr);
return val_decimal_from_str(blob, length, THD *thd= get_thd();
Field_blob::charset(), decimal_value); Converter_str2my_decimal_with_warn(thd, Warn_filter(thd),
E_DEC_FATAL_ERROR,
Field_blob::charset(),
blob, length, decimal_value);
return decimal_value;
} }

View file

@ -56,6 +56,231 @@ enum enum_check_fields
*/ */
class Value_source 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: public:
/* /*
The enumeration Subst_constraint is currently used only in implementations The enumeration Subst_constraint is currently used only in implementations
@ -1207,6 +1432,20 @@ protected:
class Field_num :public Field { class Field_num :public Field {
protected: 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; void prepend_zeros(String *value) const;
Item *get_equal_zerofill_const_item(THD *thd, const Context &ctx, Item *get_equal_zerofill_const_item(THD *thd, const Context &ctx,
Item *const_item); Item *const_item);
@ -1244,11 +1483,6 @@ public:
return length; return length;
} }
int store_time_dec(MYSQL_TIME *ltime, uint dec); 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) double pos_in_interval(Field *min, Field *max)
{ {
return pos_in_interval_val_real(min, max); return pos_in_interval_val_real(min, max);
@ -1318,9 +1552,6 @@ protected:
const Item *item) const; const Item *item) const;
bool cmp_to_string_with_stricter_collation(const Item_bool_func *cond, bool cmp_to_string_with_stricter_collation(const Item_bool_func *cond,
const Item *item) const; const Item *item) const;
my_decimal *val_decimal_from_str(const char *str, uint length,
CHARSET_INFO *cs,
my_decimal *decimal_value);
public: public:
Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg, uchar null_bit_arg, utype unireg_check_arg,
@ -1342,6 +1573,8 @@ public:
/* base class for float and double and decimal (old one) */ /* base class for float and double and decimal (old one) */
class Field_real :public Field_num { class Field_real :public Field_num {
protected:
double get_double(const char *str, uint length, CHARSET_INFO *cs, int *err);
public: public:
bool not_fixed; 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 Field_string :public Field_longstr {
class Warn_filter_string: public Warn_filter
{
public:
Warn_filter_string(const THD *thd, const Field_string *field);
};
public: public:
bool can_alter_field_type; bool can_alter_field_type;
Field_string(uchar *ptr_arg, uint32 len_arg,uchar *null_ptr_arg, Field_string(uchar *ptr_arg, uint32 len_arg,uchar *null_ptr_arg,
@ -2558,6 +2796,14 @@ private:
class Field_varstring :public Field_longstr { 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: public:
/* /*
The maximum space available in a Field_varstring, in bytes. See The maximum space available in a Field_varstring, in bytes. See

View file

@ -317,18 +317,8 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
if (!(res= val_str(&str_value))) if (!(res= val_str(&str_value)))
return 0; return 0;
if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM, return decimal_from_string_with_check(decimal_value,
res->ptr(), res->length(), res->charset(), res->charset(), res->ptr(), res->end());
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;
} }
@ -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() double Item_string::val_real()
{ {
DBUG_ASSERT(fixed == 1); 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 @todo
Give error if we wanted a signed integer and we got an unsigned one Give error if we wanted a signed integer and we got an unsigned one

View file

@ -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 class Item_static_string_func :public Item_string
{ {
const char *func_name; const char *func_name;

View file

@ -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) longlong Item_func_signed::val_int_from_str(int *error)
{ {
char buff[MAX_FIELD_WIDTH], *end, *start; char buff[MAX_FIELD_WIDTH];
uint32 length;
String tmp(buff,sizeof(buff), &my_charset_bin), *res; 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 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; return 0;
} }
null_value= 0; null_value= 0;
start= (char *)res->ptr(); Converter_strtoll10_with_warn cnv(NULL, Warn_filter_all(),
length= res->length(); res->charset(), res->ptr(), res->length());
cs= res->charset(); *error= cnv.error();
return cnv.result();
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;
} }

View file

@ -5081,13 +5081,15 @@ my_decimal *Item_dyncol_get::val_decimal(my_decimal *decimal_value)
break; break;
case DYN_COL_STRING: case DYN_COL_STRING:
{ {
const char *end;
int rc; int rc;
rc= str2my_decimal(0, val.x.string.value.str, val.x.string.value.length, 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]; char buff[80];
strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1, strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1,
val.x.string.value.length)); 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; THD *thd= current_thd;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,

View file

@ -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, 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; int err;
char buff[STRING_BUFFER_USUAL_SIZE]; char buff[STRING_BUFFER_USUAL_SIZE];
String tmp(buff, sizeof(buff), &my_charset_bin); 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(); length= tmp.length();
charset= &my_charset_bin; charset= &my_charset_bin;
} }
from_end= end= (char*) from+length; char *end= (char*) from + length;
err= string2decimal((char *)from, (decimal_t*) decimal_value, &end); err= string2decimal((char *)from, (decimal_t*) decimal_value, &end);
if (end != from_end && !err) if (charset->mbminlen > 1)
{ end= (char *) from + charset->mbminlen * (size_t) (end - buff);
/* Give warning if there is something other than end space */ *end_ptr= end;
for ( ; end < from_end; end++)
{
if (!my_isspace(&my_charset_latin1, *end))
{
err= E_DEC_TRUNCATED;
break;
}
}
}
check_result_and_overflow(mask, err, decimal_value); check_result_and_overflow(mask, err, decimal_value);
return err; return err;
} }

View file

@ -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, 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) #if defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
inline inline
int string2my_decimal(uint mask, const String *str, my_decimal *d) 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);
} }

View file

@ -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 optionally it can be assigned to, optionally it can have a command-line
counterpart with the same name. counterpart with the same name.
*/ */
class sys_var class sys_var: protected Value_source // for double_from_string_with_check
{ {
public: public:
sys_var *next; sys_var *next;

View file

@ -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 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"); insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings: 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 Note 1265 Data truncated for column 'a' at row 3
select * from t1; select * from t1;
a 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 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"); insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings: 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 Note 1265 Data truncated for column 'a' at row 3
select * from t1; select * from t1;
a 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 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"); insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings: 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 Note 1265 Data truncated for column 'a' at row 3
select * from t1; select * from t1;
a a
@ -359,6 +359,9 @@ insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings: Warnings:
Note 1265 Data truncated for column 'a' at row 3 Note 1265 Data truncated for column 'a' at row 3
insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 "); 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; select * from t1;
a a
0.00 0.00

View file

@ -469,6 +469,7 @@ SELECT 5 = a FROM t1;
0 0
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's' Warning 1292 Truncated incorrect DOUBLE value: 's'
Warning 1292 Truncated incorrect DOUBLE value: ''
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a CHAR(16)); CREATE TABLE t1 (a CHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), (''); INSERT INTO t1 VALUES ('5'), ('s'), ('');
@ -479,4 +480,5 @@ SELECT 5 = a FROM t1;
0 0
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's ' Warning 1292 Truncated incorrect DOUBLE value: 's '
Warning 1292 Truncated incorrect DOUBLE value: ' '
DROP TABLE t1; DROP TABLE t1;

View file

@ -1619,7 +1619,10 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */
if ((negative_exp= (*str == '-')) || *str=='+') if ((negative_exp= (*str == '-')) || *str=='+')
{ {
if (++str == end) if (++str == end)
{
str-= 2; /* 'e-' or 'e+' not followed by digits */
goto ret_sign; goto ret_sign;
}
} }
for (exponent= 0 ; for (exponent= 0 ;
str < end && (ch= (uchar) (*str - '0')) < 10; str < end && (ch= (uchar) (*str - '0')) < 10;
@ -1629,6 +1632,8 @@ exp: /* [ E [ <sign> ] <unsigned integer> ] */
} }
shift+= negative_exp ? -exponent : exponent; shift+= negative_exp ? -exponent : exponent;
} }
else
str--; /* 'e' not followed by digits */
} }
if (shift == 0) /* No shift, check addon digit */ if (shift == 0) /* No shift, check addon digit */