Skip to content

Commit 5eb71ac

Browse files
author
Staale Smedseng
committed
This is a backport of the two patches for Bug #28299:
To-number conversion warnings work differenly with CHAR and VARCHAR sp variables. The original revision-IDs are: staale.smedseng@sun.com-20081124095339-2qdvzkp0rn1ljs30 staale.smedseng@sun.com-20081125104611-rtxic5d12e83ag2o The patch provides ER_TRUNCATED_WRONG_VALUE warning messages for conversion of VARCHAR to numberic values, in line with messages provided for CHAR conversions. Conversions are checked for success, and the message is emitted in case failure. The tests are amended to accept the added warning messages, and explicit conversion of ON/OFF values is added for statements checking system variables. In test rpl.rpl_switch_stm_row_mixed checking for warnings is temporarily disabled for one statement, as this generates warning messages for strings that vary between executions.
1 parent e15708d commit 5eb71ac

File tree

102 files changed

+542
-235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+542
-235
lines changed

mysql-test/r/func_math.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ y
382382
SELECT b DIV 900 y FROM t1 GROUP BY y;
383383
y
384384
0
385+
Warnings:
386+
Warning 1292 Truncated incorrect INTEGER value: 'str1'
387+
Warning 1292 Truncated incorrect INTEGER value: 'str2'
385388
SELECT c DIV 900 y FROM t1 GROUP BY y;
386389
y
387390
0

mysql-test/r/func_str.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,9 @@ INSERT INTO t2 VALUES (0), (1);
11511151
SELECT * FROM t1, t2 WHERE num=str;
11521152
str num
11531153
notnumber 0
1154+
Warnings:
1155+
Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
1156+
Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
11541157
SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
11551158
str num
11561159
notnumber 0

mysql-test/r/profiling.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,13 @@ id
298298
1
299299
2
300300
3
301+
Warnings:
302+
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
303+
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
304+
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
305+
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
306+
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
307+
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
301308
select @@profiling;
302309
@@profiling
303310
1

mysql-test/r/ps_1general.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ b char(10) YES NULL
279279
SET @arg00=1;
280280
execute stmt4 using @arg00;
281281
Field Type Null Key Default Extra
282+
Warnings:
283+
Warning 1292 Truncated incorrect DOUBLE value: 'a'
284+
Warning 1292 Truncated incorrect DOUBLE value: 'b'
282285
prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
283286
execute stmt4;
284287
Field Type Null Key Default Extra

mysql-test/r/sp-vars.result

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,3 +1158,30 @@ f1() @b
11581158
0 abc
11591159
drop function f1;
11601160
drop table t1;
1161+
1162+
---------------------------------------------------------------
1163+
BUG#28299
1164+
---------------------------------------------------------------
1165+
1166+
CREATE PROCEDURE ctest()
1167+
BEGIN
1168+
DECLARE i CHAR(16);
1169+
DECLARE j INT;
1170+
SET i= 'string';
1171+
SET j= 1 + i;
1172+
END|
1173+
CALL ctest();
1174+
Warnings:
1175+
Warning 1292 Truncated incorrect DOUBLE value: 'string '
1176+
DROP PROCEDURE ctest;
1177+
CREATE PROCEDURE vctest()
1178+
BEGIN
1179+
DECLARE i VARCHAR(16);
1180+
DECLARE j INT;
1181+
SET i= 'string';
1182+
SET j= 1 + i;
1183+
END|
1184+
CALL vctest();
1185+
Warnings:
1186+
Warning 1292 Truncated incorrect DOUBLE value: 'string'
1187+
DROP PROCEDURE vctest;

mysql-test/r/type_varchar.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,3 +489,23 @@ Warnings:
489489
Warning 1292 Truncated incorrect INTEGER value: '1a'
490490
Warning 1292 Truncated incorrect INTEGER value: 't'
491491
DROP TABLE t1;
492+
CREATE TABLE t1 (a VARCHAR(16));
493+
INSERT INTO t1 VALUES ('5'), ('s'), ('');
494+
SELECT 5 = a FROM t1;
495+
5 = a
496+
1
497+
0
498+
0
499+
Warnings:
500+
Warning 1292 Truncated incorrect DOUBLE value: 's'
501+
DROP TABLE t1;
502+
CREATE TABLE t1 (a CHAR(16));
503+
INSERT INTO t1 VALUES ('5'), ('s'), ('');
504+
SELECT 5 = a FROM t1;
505+
5 = a
506+
1
507+
0
508+
0
509+
Warnings:
510+
Warning 1292 Truncated incorrect DOUBLE value: 's '
511+
DROP TABLE t1;

mysql-test/suite/funcs_1/r/innodb_func_view.result

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,6 +2096,9 @@ IS NOT TRUE 2
20962096
IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
20972097
IS NOT TRUE ---äÖüß@µ*$-- 4
20982098
IS TRUE -1 5
2099+
Warnings:
2100+
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
2101+
Warning 1292 Truncated incorrect DOUBLE value: ' ---����@�*$-- '
20992102
SHOW CREATE VIEW v1;
21002103
View Create View character_set_client collation_connection
21012104
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
@@ -2108,6 +2111,9 @@ IS NOT TRUE 2
21082111
IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
21092112
IS NOT TRUE ---äÖüß@µ*$-- 4
21102113
IS TRUE -1 5
2114+
Warnings:
2115+
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
2116+
Warning 1292 Truncated incorrect DOUBLE value: ' ---����@�*$-- '
21112117
DROP VIEW v1;
21122118

21132119

@@ -2158,6 +2164,9 @@ IS NOT TRUE 2
21582164
IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
21592165
IS NOT TRUE ---äÖüß@µ*$-- 4
21602166
IS TRUE -1 5
2167+
Warnings:
2168+
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
2169+
Warning 1292 Truncated incorrect DOUBLE value: ' ---����@�*$-- '
21612170
SHOW CREATE VIEW v1;
21622171
View Create View character_set_client collation_connection
21632172
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
@@ -2170,6 +2179,9 @@ IS NOT TRUE 2
21702179
IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3
21712180
IS NOT TRUE ---äÖüß@µ*$-- 4
21722181
IS TRUE -1 5
2182+
Warnings:
2183+
Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
2184+
Warning 1292 Truncated incorrect DOUBLE value: ' ---����@�*$-- '
21732185
DROP VIEW v1;
21742186

21752187

@@ -3373,8 +3385,11 @@ NULL NULL 1
33733385
-3333.33 -3333.3333 29
33743386
Warnings:
33753387
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3388+
Warning 1292 Truncated incorrect DECIMAL value: ''
33763389
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3390+
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
33773391
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3392+
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
33783393
SHOW CREATE VIEW v1;
33793394
View Create View character_set_client collation_connection
33803395
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3390,8 +3405,11 @@ NULL NULL 1
33903405
-3333.33 -3333.3333 29
33913406
Warnings:
33923407
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3408+
Warning 1292 Truncated incorrect DECIMAL value: ''
33933409
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3410+
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
33943411
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3412+
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
33953413
DROP VIEW v1;
33963414

33973415

@@ -3455,8 +3473,11 @@ NULL NULL 1
34553473
-3333.33 -3333.3333 27
34563474
Warnings:
34573475
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3476+
Warning 1292 Truncated incorrect DECIMAL value: ''
34583477
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3478+
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
34593479
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3480+
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
34603481
SHOW CREATE VIEW v1;
34613482
View Create View character_set_client collation_connection
34623483
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3472,8 +3493,11 @@ NULL NULL 1
34723493
-3333.33 -3333.3333 27
34733494
Warnings:
34743495
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3496+
Warning 1292 Truncated incorrect DECIMAL value: ''
34753497
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3498+
Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------'
34763499
Warning 1366 Incorrect decimal value: '' for column '' at row -1
3500+
Warning 1292 Truncated incorrect DECIMAL value: ' ---����@�*$-- '
34773501
DROP VIEW v1;
34783502

34793503

mysql-test/suite/funcs_1/r/innodb_views.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22843,6 +22843,9 @@ SELECT * FROM v1 order by 2;
2284322843
f1 my_sqrt
2284422844
ABC 0
2284522845
ABC 1.73205080756888
22846+
Warnings:
22847+
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
22848+
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
2284622849
SELECT SQRT('DEF');
2284722850
SQRT('DEF')
2284822851
0
@@ -22863,21 +22866,30 @@ SELECT * FROM v2 order by 2;
2286322866
f1 my_sqrt
2286422867
ABC 0
2286522868
ABC 1.73205080756888
22869+
Warnings:
22870+
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
22871+
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
2286622872
CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1;
22873+
Warnings:
22874+
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
2286722875
SELECT * FROM t2 order by 2;
2286822876
f1 ABC
2286922877
my_sqrt 0
2287022878
f1 ABC
2287122879
my_sqrt 1.73205080756888
2287222880
DROP TABLE t2;
2287322881
CREATE TABLE t2 AS SELECT * FROM v1;
22882+
Warnings:
22883+
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
2287422884
SELECT * FROM t2 order by 2;
2287522885
f1 ABC
2287622886
my_sqrt 0
2287722887
f1 ABC
2287822888
my_sqrt 1.73205080756888
2287922889
DROP TABLE t2;
2288022890
CREATE TABLE t2 AS SELECT * FROM v2;
22891+
Warnings:
22892+
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
2288122893
SELECT * FROM t2 order by 2;
2288222894
f1 ABC
2288322895
my_sqrt 0

0 commit comments

Comments
 (0)