Skip to content

Commit fefd6d5

Browse files
committed
MDEV-32656: ASAN errors in base_list_iterator::next / setup_table_map upon 2nd execution of PS
Correctly supress error issuing when saving value in field for comporison
1 parent 1697747 commit fefd6d5

11 files changed

+161
-5
lines changed

mysql-test/main/subselect.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7497,3 +7497,24 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
74977497
#
74987498
# End of 10.4 tests
74997499
#
7500+
#
7501+
# MDEV-32656: ASAN errors in base_list_iterator::next /
7502+
# setup_table_map upon 2nd execution of PS
7503+
# (10.6 part)
7504+
#
7505+
CREATE TABLE t1 (id BIGINT);
7506+
INSERT INTO t1 VALUES (1),(2);
7507+
CREATE VIEW v1 AS SELECT * FROM t1;
7508+
CREATE TABLE t2 (a INT);
7509+
INSERT INTO t2 VALUES (2),(3);
7510+
CREATE TABLE t3 (b INT);
7511+
INSERT INTO t3 VALUES (3),(4);
7512+
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
7513+
Warnings:
7514+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7515+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7516+
drop view v1;
7517+
drop table t1, t2, t3;
7518+
#
7519+
# End of 10.6 tests
7520+
#

mysql-test/main/subselect.test

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6351,3 +6351,30 @@ SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
63516351
--echo #
63526352
--echo # End of 10.4 tests
63536353
--echo #
6354+
6355+
6356+
6357+
--echo #
6358+
--echo # MDEV-32656: ASAN errors in base_list_iterator::next /
6359+
--echo # setup_table_map upon 2nd execution of PS
6360+
--echo # (10.6 part)
6361+
--echo #
6362+
6363+
CREATE TABLE t1 (id BIGINT);
6364+
INSERT INTO t1 VALUES (1),(2);
6365+
CREATE VIEW v1 AS SELECT * FROM t1;
6366+
6367+
CREATE TABLE t2 (a INT);
6368+
INSERT INTO t2 VALUES (2),(3);
6369+
6370+
CREATE TABLE t3 (b INT);
6371+
INSERT INTO t3 VALUES (3),(4);
6372+
6373+
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
6374+
6375+
drop view v1;
6376+
drop table t1, t2, t3;
6377+
6378+
--echo #
6379+
--echo # End of 10.6 tests
6380+
--echo #

mysql-test/main/subselect_mat.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2697,7 +2697,7 @@ INSERT INTO t2 VALUES (3),(4);
26972697
CREATE TABLE t3 (c DATETIME, d INT, KEY(c));
26982698
INSERT INTO t3 VALUES ('2012-11-11',5),('2012-12-12',6);
26992699
UPDATE t1, t2 SET t1.a = 26 WHERE t2.b IN (SELECT MIN(d) FROM t3 WHERE c >= '2012-01');
2700-
ERROR 22007: Incorrect datetime value: '2012-01' for column `test`.`t3`.`c` at row 1
2700+
ERROR 22007: Truncated incorrect datetime value: '2012-01'
27012701
DROP TABLE t1, t2, t3;
27022702
#
27032703
# a followup fix:

mysql-test/main/subselect_no_exists_to_in.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7497,6 +7497,27 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
74977497
#
74987498
# End of 10.4 tests
74997499
#
7500+
#
7501+
# MDEV-32656: ASAN errors in base_list_iterator::next /
7502+
# setup_table_map upon 2nd execution of PS
7503+
# (10.6 part)
7504+
#
7505+
CREATE TABLE t1 (id BIGINT);
7506+
INSERT INTO t1 VALUES (1),(2);
7507+
CREATE VIEW v1 AS SELECT * FROM t1;
7508+
CREATE TABLE t2 (a INT);
7509+
INSERT INTO t2 VALUES (2),(3);
7510+
CREATE TABLE t3 (b INT);
7511+
INSERT INTO t3 VALUES (3),(4);
7512+
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
7513+
Warnings:
7514+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7515+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7516+
drop view v1;
7517+
drop table t1, t2, t3;
7518+
#
7519+
# End of 10.6 tests
7520+
#
75007521
set optimizer_switch=default;
75017522
select @@optimizer_switch like '%exists_to_in=off%';
75027523
@@optimizer_switch like '%exists_to_in=off%'

mysql-test/main/subselect_no_mat.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7490,6 +7490,27 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
74907490
#
74917491
# End of 10.4 tests
74927492
#
7493+
#
7494+
# MDEV-32656: ASAN errors in base_list_iterator::next /
7495+
# setup_table_map upon 2nd execution of PS
7496+
# (10.6 part)
7497+
#
7498+
CREATE TABLE t1 (id BIGINT);
7499+
INSERT INTO t1 VALUES (1),(2);
7500+
CREATE VIEW v1 AS SELECT * FROM t1;
7501+
CREATE TABLE t2 (a INT);
7502+
INSERT INTO t2 VALUES (2),(3);
7503+
CREATE TABLE t3 (b INT);
7504+
INSERT INTO t3 VALUES (3),(4);
7505+
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
7506+
Warnings:
7507+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7508+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7509+
drop view v1;
7510+
drop table t1, t2, t3;
7511+
#
7512+
# End of 10.6 tests
7513+
#
74937514
set optimizer_switch=default;
74947515
select @@optimizer_switch like '%materialization=on%';
74957516
@@optimizer_switch like '%materialization=on%'

mysql-test/main/subselect_no_opts.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7488,4 +7488,25 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
74887488
#
74897489
# End of 10.4 tests
74907490
#
7491+
#
7492+
# MDEV-32656: ASAN errors in base_list_iterator::next /
7493+
# setup_table_map upon 2nd execution of PS
7494+
# (10.6 part)
7495+
#
7496+
CREATE TABLE t1 (id BIGINT);
7497+
INSERT INTO t1 VALUES (1),(2);
7498+
CREATE VIEW v1 AS SELECT * FROM t1;
7499+
CREATE TABLE t2 (a INT);
7500+
INSERT INTO t2 VALUES (2),(3);
7501+
CREATE TABLE t3 (b INT);
7502+
INSERT INTO t3 VALUES (3),(4);
7503+
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
7504+
Warnings:
7505+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7506+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7507+
drop view v1;
7508+
drop table t1, t2, t3;
7509+
#
7510+
# End of 10.6 tests
7511+
#
74917512
set @optimizer_switch_for_subselect_test=null;

mysql-test/main/subselect_no_scache.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7503,6 +7503,27 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
75037503
#
75047504
# End of 10.4 tests
75057505
#
7506+
#
7507+
# MDEV-32656: ASAN errors in base_list_iterator::next /
7508+
# setup_table_map upon 2nd execution of PS
7509+
# (10.6 part)
7510+
#
7511+
CREATE TABLE t1 (id BIGINT);
7512+
INSERT INTO t1 VALUES (1),(2);
7513+
CREATE VIEW v1 AS SELECT * FROM t1;
7514+
CREATE TABLE t2 (a INT);
7515+
INSERT INTO t2 VALUES (2),(3);
7516+
CREATE TABLE t3 (b INT);
7517+
INSERT INTO t3 VALUES (3),(4);
7518+
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
7519+
Warnings:
7520+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7521+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7522+
drop view v1;
7523+
drop table t1, t2, t3;
7524+
#
7525+
# End of 10.6 tests
7526+
#
75067527
set optimizer_switch=default;
75077528
select @@optimizer_switch like '%subquery_cache=on%';
75087529
@@optimizer_switch like '%subquery_cache=on%'

mysql-test/main/subselect_no_semijoin.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7489,6 +7489,27 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
74897489
# End of 10.4 tests
74907490
#
74917491
#
7492+
# MDEV-32656: ASAN errors in base_list_iterator::next /
7493+
# setup_table_map upon 2nd execution of PS
7494+
# (10.6 part)
7495+
#
7496+
CREATE TABLE t1 (id BIGINT);
7497+
INSERT INTO t1 VALUES (1),(2);
7498+
CREATE VIEW v1 AS SELECT * FROM t1;
7499+
CREATE TABLE t2 (a INT);
7500+
INSERT INTO t2 VALUES (2),(3);
7501+
CREATE TABLE t3 (b INT);
7502+
INSERT INTO t3 VALUES (3),(4);
7503+
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
7504+
Warnings:
7505+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7506+
Warning 1292 Truncated incorrect DECIMAL value: 'e'
7507+
drop view v1;
7508+
drop table t1, t2, t3;
7509+
#
7510+
# End of 10.6 tests
7511+
#
7512+
#
74927513
# MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSON
74937514
#
74947515
CREATE TABLE t1 ( a INT );

mysql-test/main/subselect_sj_mat.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2739,7 +2739,7 @@ INSERT INTO t2 VALUES (3),(4);
27392739
CREATE TABLE t3 (c DATETIME, d INT, KEY(c));
27402740
INSERT INTO t3 VALUES ('2012-11-11',5),('2012-12-12',6);
27412741
UPDATE t1, t2 SET t1.a = 26 WHERE t2.b IN (SELECT MIN(d) FROM t3 WHERE c >= '2012-01');
2742-
ERROR 22007: Incorrect datetime value: '2012-01' for column `test`.`t3`.`c` at row 1
2742+
ERROR 22007: Truncated incorrect datetime value: '2012-01'
27432743
DROP TABLE t1, t2, t3;
27442744
#
27452745
# a followup fix:

sql/item_cmpfunc.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
333333
!(*item)->with_sum_func())
334334
{
335335
TABLE *table= field->table;
336+
Use_relaxed_field_copy urfc(thd);
336337
MY_BITMAP *old_maps[2] = { NULL, NULL };
337338
ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */
338339
bool save_field_value;
@@ -351,7 +352,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
351352
!(field->table->status & STATUS_NO_RECORD));
352353
if (save_field_value)
353354
orig_field_val= field->val_int();
354-
if (!(*item)->save_in_field_no_warnings(field, 1) && !field->is_null())
355+
if (!(*item)->save_in_field(field, 1) && !field->is_null())
355356
{
356357
int field_cmp= 0;
357358
// If item is a decimal value, we must reject it if it was truncated.

0 commit comments

Comments
 (0)