Skip to content

Commit 30711c6

Browse files
author
Alexander Barkov
committed
MDEV-8806 Numeric CAST produce different warnings for strings literals vs functions
1 parent 26e4403 commit 30711c6

23 files changed

+169
-84
lines changed

mysql-test/r/func_group.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,9 @@ select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d orde
21072107
avg(export_set( 3, 'y', sha(i))) group_concat(d)
21082108
0 2008-10-02
21092109
0 2010-12-12
2110+
Warnings:
2111+
Warning 1292 Truncated incorrect DOUBLE value: 'y,y,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428ab,3'
2112+
Warning 1292 Truncated incorrect DOUBLE value: 'y,y,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b0,d'
21102113
drop table t1;
21112114
#
21122115
# MDEV-4290: crash in st_select_lex::mark_as_dependent

mysql-test/r/func_math.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,9 @@ SELECT floor(log10(format(concat_ws(5445796E25, 5306463, 30837), -358821)))
702702
as foo;
703703
foo
704704
2
705+
Warnings:
706+
Warning 1292 Truncated incorrect DOUBLE value: '53064635.445796e3130837'
707+
Warning 1292 Truncated incorrect DOUBLE value: '179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,'
705708
#
706709
# Bug #58137 char(0) column cause:
707710
# my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed

mysql-test/r/func_misc.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ INSERT INTO t1 VALUES ('', 0);
295295
SELECT COALESCE(a) = COALESCE(b) FROM t1;
296296
COALESCE(a) = COALESCE(b)
297297
1
298+
Warnings:
299+
Warning 1292 Truncated incorrect DOUBLE value: ''
298300
DROP TABLE t1;
299301
#
300302
# Bug #54461: crash with longblob and union or update with subquery

mysql-test/r/func_regexp_pcre.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
445445
Warnings:
446446
Note 1003 select regexp_replace('abc','b','x') AS `REGEXP_REPLACE('abc','b','x')`
447447
CREATE TABLE t1 AS SELECT REGEXP_REPLACE('abc','b','x')+0;
448+
Warnings:
449+
Warning 1292 Truncated incorrect DOUBLE value: 'axc'
448450
SHOW CREATE TABLE t1;
449451
Table Create Table
450452
t1 CREATE TABLE `t1` (
@@ -745,6 +747,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
745747
Warnings:
746748
Note 1003 select regexp_substr('abc','b') AS `REGEXP_SUBSTR('abc','b')`
747749
CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b')+0;
750+
Warnings:
751+
Warning 1292 Truncated incorrect DOUBLE value: 'b'
748752
SHOW CREATE TABLE t1;
749753
Table Create Table
750754
t1 CREATE TABLE `t1` (

mysql-test/r/func_str.result

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,8 @@ Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
11601160
SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
11611161
str num
11621162
notnumber 0
1163+
Warnings:
1164+
Warning 1292 Truncated incorrect DOUBLE value: 'notnum'
11631165
DROP TABLE t1,t2;
11641166
CREATE TABLE t1(
11651167
id int(11) NOT NULL auto_increment,
@@ -1352,6 +1354,8 @@ cast(rtrim(' 20.06 ') as decimal(19,2))
13521354
select cast(ltrim(' 20.06 ') as decimal(19,2));
13531355
cast(ltrim(' 20.06 ') as decimal(19,2))
13541356
20.06
1357+
Warnings:
1358+
Note 1292 Truncated incorrect DECIMAL value: '20.06 '
13551359
select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2));
13561360
cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2))
13571361
20.06
@@ -2915,7 +2919,7 @@ format(rpad('111111111.1',
29152919
1111111,
29162920
'999999999999999999999999999999999999999999'),0,'be_BY')
29172921
;
2918-
DO
2922+
SELECT
29192923
round(
29202924
concat( (
29212925
coalesce( (
@@ -2930,9 +2934,14 @@ sha1('P'),
29302934
)
29312935
)
29322936
)
2933-
);
2937+
) AS r;
2938+
r
2939+
0
29342940
Warnings:
2941+
Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9'
29352942
Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
2943+
Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9'
2944+
Warning 1292 Truncated incorrect DOUBLE value: '0.000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'
29362945
SET @@global.max_allowed_packet:= @tmp_max;
29372946
SELECT @tmp_max:= @@global.max_allowed_packet;
29382947
@tmp_max:= @@global.max_allowed_packet

mysql-test/r/func_time.result

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ Saturday 5
163163
select monthname("1972-03-04"),monthname("1972-03-04")+0;
164164
monthname("1972-03-04") monthname("1972-03-04")+0
165165
March 0
166+
Warnings:
167+
Warning 1292 Truncated incorrect DOUBLE value: 'March'
166168
select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
167169
time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
168170
00|12|0|12|00|AM|12:00:00 AM|00|00:00:00 00|12|0|12|00|AM|12:00:00 AM|00|00:00:00
@@ -1966,6 +1968,9 @@ SELECT * FROM t1 GROUP BY SEC_TO_TIME(concat(a,'10'))*1;
19661968
a
19671969
2000-02-23
19681970
2005-05-04
1971+
Warnings:
1972+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
1973+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
19691974
DROP TABLE t1;
19701975
CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
19711976
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
@@ -2015,22 +2020,37 @@ SELECT * FROM t1 GROUP BY FROM_UNIXTIME(concat(a,'10'))*1;
20152020
a
20162021
2000-02-23
20172022
2005-05-04
2023+
Warnings:
2024+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2025+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
20182026
SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10')))*1;
20192027
a
20202028
2005-05-04
20212029
2000-02-23
2030+
Warnings:
2031+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2032+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
20222033
SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10')));
20232034
a
20242035
2005-05-04
20252036
2000-02-23
2037+
Warnings:
2038+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2039+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
20262040
SELECT * FROM t1 GROUP BY ABS(FROM_UNIXTIME(concat(a,'10')));
20272041
a
20282042
2000-02-23
20292043
2005-05-04
2044+
Warnings:
2045+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2046+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
20302047
SELECT * FROM t1 GROUP BY @a:=(FROM_UNIXTIME(concat(a,'10'))*1);
20312048
a
20322049
2000-02-23
20332050
2005-05-04
2051+
Warnings:
2052+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2053+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
20342054
DROP TABLE t1;
20352055
SET TIME_ZONE='+02:00';
20362056
#
@@ -2042,27 +2062,47 @@ SELECT a, FROM_UNIXTIME(CONCAT(a,'10')) AS f1, FROM_UNIXTIME(CONCAT(a,'10'))+0 A
20422062
a f1 f2
20432063
2005-05-04 1970-01-01 02:33:25 19700101023325.000000
20442064
2000-02-23 1970-01-01 02:33:20 19700101023320.000000
2065+
Warnings:
2066+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2067+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2068+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
2069+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
20452070
SELECT * FROM t1 GROUP BY FROM_UNIXTIME(CONCAT(a,'10'))+0;
20462071
a
20472072
2000-02-23
20482073
2005-05-04
2074+
Warnings:
2075+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2076+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
20492077
DROP TABLE t1;
20502078
CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
20512079
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
20522080
SELECT * FROM t1 GROUP BY FROM_UNIXTIME(concat(a,'10'))/1;
20532081
a
20542082
2000-02-23
20552083
2005-05-04
2084+
Warnings:
2085+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2086+
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
20562087
DROP TABLE t1;
20572088
CREATE TABLE t1 (a DATE);
20582089
INSERT INTO t1 VALUES ('2005-05-04');
20592090
SELECT CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10'))) AS f2 FROM t1;
20602091
f2
20612092
0.000000
2093+
Warnings:
2094+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2095+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
20622096
SELECT CHAR_LENGTH(CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10')))) AS f2 FROM t1;
20632097
f2
20642098
8
2099+
Warnings:
2100+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2101+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
20652102
CREATE TABLE t2 AS SELECT CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10'))) AS f2 FROM t1;
2103+
Warnings:
2104+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
2105+
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
20662106
SHOW CREATE TABLE t2;
20672107
Table Create Table
20682108
t2 CREATE TABLE `t2` (

mysql-test/r/subselect_sj.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,9 @@ f1 f2 f3 f3
20942094
4 0 0 0
20952095
4 0 0 0
20962096
0 NULL NULL NULL
2097+
Warnings:
2098+
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
2099+
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
20972100
DROP TABLE t1, t2, t3, t4;
20982101
set @tmp803457=@@optimizer_switch;
20992102
#

mysql-test/r/subselect_sj_jcl6.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,9 @@ f1 f2 f3 f3
21082108
4 0 0 0
21092109
4 0 0 0
21102110
0 NULL NULL NULL
2111+
Warnings:
2112+
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
2113+
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
21112114
DROP TABLE t1, t2, t3, t4;
21122115
set @tmp803457=@@optimizer_switch;
21132116
#

mysql-test/r/xml.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,8 @@ aa bb
11841184
SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,..)');
11851185
ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,..)')
11861186

1187+
Warnings:
1188+
Warning 1292 Truncated incorrect INTEGER value: ''
11871189
#
11881190
# Bug#62429 XML: ExtractValue, UpdateXML max arg length 127 chars
11891191
#
@@ -1243,6 +1245,8 @@ DROP TABLE t1;
12431245
SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,..)') AS e;
12441246
e
12451247

1248+
Warnings:
1249+
Warning 1292 Truncated incorrect INTEGER value: ''
12461250
SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,/a/c)') AS e;
12471251
e
12481252
bc

mysql-test/suite/rpl/r/rpl_row_create_select.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ include/master-slave.inc
88
#value of 21.
99
CREATE TABLE t1 AS SELECT REPEAT('A', 1000) DIV 1 AS a;
1010
Warnings:
11-
Warning 1918 Encountered illegal value '' when converting to DECIMAL
11+
Warning 1292 Truncated incorrect DECIMAL value: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
1212
SHOW CREATE TABLE t1;
1313
Table Create Table
1414
t1 CREATE TABLE `t1` (
1515
`a` bigint(21) DEFAULT NULL
1616
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1717
CREATE TABLE t2 AS SELECT CONVERT(REPEAT('A', 255) USING UCS2) DIV 1 AS a;
1818
Warnings:
19-
Warning 1918 Encountered illegal value '' when converting to DECIMAL
19+
Warning 1292 Truncated incorrect DECIMAL value: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
2020
SHOW CREATE TABLE t2;
2121
Table Create Table
2222
t2 CREATE TABLE `t2` (

0 commit comments

Comments
 (0)