Commit fefd6d55 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

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
parent 16977474
......@@ -7497,3 +7497,24 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# End of 10.4 tests
#
#
# MDEV-32656: ASAN errors in base_list_iterator::next /
# setup_table_map upon 2nd execution of PS
# (10.6 part)
#
CREATE TABLE t1 (id BIGINT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (b INT);
INSERT INTO t3 VALUES (3),(4);
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'e'
Warning 1292 Truncated incorrect DECIMAL value: 'e'
drop view v1;
drop table t1, t2, t3;
#
# End of 10.6 tests
#
......@@ -6351,3 +6351,30 @@ SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
--echo #
--echo # End of 10.4 tests
--echo #
--echo #
--echo # MDEV-32656: ASAN errors in base_list_iterator::next /
--echo # setup_table_map upon 2nd execution of PS
--echo # (10.6 part)
--echo #
CREATE TABLE t1 (id BIGINT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (b INT);
INSERT INTO t3 VALUES (3),(4);
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
drop view v1;
drop table t1, t2, t3;
--echo #
--echo # End of 10.6 tests
--echo #
......@@ -2697,7 +2697,7 @@ INSERT INTO t2 VALUES (3),(4);
CREATE TABLE t3 (c DATETIME, d INT, KEY(c));
INSERT INTO t3 VALUES ('2012-11-11',5),('2012-12-12',6);
UPDATE t1, t2 SET t1.a = 26 WHERE t2.b IN (SELECT MIN(d) FROM t3 WHERE c >= '2012-01');
ERROR 22007: Incorrect datetime value: '2012-01' for column `test`.`t3`.`c` at row 1
ERROR 22007: Truncated incorrect datetime value: '2012-01'
DROP TABLE t1, t2, t3;
#
# a followup fix:
......
......@@ -7497,6 +7497,27 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# End of 10.4 tests
#
#
# MDEV-32656: ASAN errors in base_list_iterator::next /
# setup_table_map upon 2nd execution of PS
# (10.6 part)
#
CREATE TABLE t1 (id BIGINT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (b INT);
INSERT INTO t3 VALUES (3),(4);
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'e'
Warning 1292 Truncated incorrect DECIMAL value: 'e'
drop view v1;
drop table t1, t2, t3;
#
# End of 10.6 tests
#
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'
......
......@@ -7490,6 +7490,27 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# End of 10.4 tests
#
#
# MDEV-32656: ASAN errors in base_list_iterator::next /
# setup_table_map upon 2nd execution of PS
# (10.6 part)
#
CREATE TABLE t1 (id BIGINT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (b INT);
INSERT INTO t3 VALUES (3),(4);
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'e'
Warning 1292 Truncated incorrect DECIMAL value: 'e'
drop view v1;
drop table t1, t2, t3;
#
# End of 10.6 tests
#
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'
......
......@@ -7488,4 +7488,25 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# End of 10.4 tests
#
#
# MDEV-32656: ASAN errors in base_list_iterator::next /
# setup_table_map upon 2nd execution of PS
# (10.6 part)
#
CREATE TABLE t1 (id BIGINT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (b INT);
INSERT INTO t3 VALUES (3),(4);
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'e'
Warning 1292 Truncated incorrect DECIMAL value: 'e'
drop view v1;
drop table t1, t2, t3;
#
# End of 10.6 tests
#
set @optimizer_switch_for_subselect_test=null;
......@@ -7503,6 +7503,27 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
#
# End of 10.4 tests
#
#
# MDEV-32656: ASAN errors in base_list_iterator::next /
# setup_table_map upon 2nd execution of PS
# (10.6 part)
#
CREATE TABLE t1 (id BIGINT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (b INT);
INSERT INTO t3 VALUES (3),(4);
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'e'
Warning 1292 Truncated incorrect DECIMAL value: 'e'
drop view v1;
drop table t1, t2, t3;
#
# End of 10.6 tests
#
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%'
......
......@@ -7489,6 +7489,27 @@ ERROR HY000: Illegal parameter data types row and boolean for operation '='
# End of 10.4 tests
#
#
# MDEV-32656: ASAN errors in base_list_iterator::next /
# setup_table_map upon 2nd execution of PS
# (10.6 part)
#
CREATE TABLE t1 (id BIGINT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (2),(3);
CREATE TABLE t3 (b INT);
INSERT INTO t3 VALUES (3),(4);
insert into t2 select (('e','e') IN (SELECT v1.id, v1.id FROM v1 JOIN t3));
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'e'
Warning 1292 Truncated incorrect DECIMAL value: 'e'
drop view v1;
drop table t1, t2, t3;
#
# End of 10.6 tests
#
#
# MDEV-19714: JOIN::pseudo_bits_cond is not visible in EXPLAIN FORMAT=JSON
#
CREATE TABLE t1 ( a INT );
......
......@@ -2739,7 +2739,7 @@ INSERT INTO t2 VALUES (3),(4);
CREATE TABLE t3 (c DATETIME, d INT, KEY(c));
INSERT INTO t3 VALUES ('2012-11-11',5),('2012-12-12',6);
UPDATE t1, t2 SET t1.a = 26 WHERE t2.b IN (SELECT MIN(d) FROM t3 WHERE c >= '2012-01');
ERROR 22007: Incorrect datetime value: '2012-01' for column `test`.`t3`.`c` at row 1
ERROR 22007: Truncated incorrect datetime value: '2012-01'
DROP TABLE t1, t2, t3;
#
# a followup fix:
......
......@@ -333,6 +333,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
!(*item)->with_sum_func())
{
TABLE *table= field->table;
Use_relaxed_field_copy urfc(thd);
MY_BITMAP *old_maps[2] = { NULL, NULL };
ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */
bool save_field_value;
......@@ -351,7 +352,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
!(field->table->status & STATUS_NO_RECORD));
if (save_field_value)
orig_field_val= field->val_int();
if (!(*item)->save_in_field_no_warnings(field, 1) && !field->is_null())
if (!(*item)->save_in_field(field, 1) && !field->is_null())
{
int field_cmp= 0;
// If item is a decimal value, we must reject it if it was truncated.
......
......@@ -7723,11 +7723,13 @@ class Check_level_instant_set
class Use_relaxed_field_copy: public Sql_mode_save,
public Check_level_instant_set
public Check_level_instant_set,
public Abort_on_warning_instant_set
{
public:
Use_relaxed_field_copy(THD *thd) :
Sql_mode_save(thd), Check_level_instant_set(thd, CHECK_FIELD_IGNORE)
Sql_mode_save(thd), Check_level_instant_set(thd, CHECK_FIELD_IGNORE),
Abort_on_warning_instant_set(thd, 0)
{
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
thd->variables.sql_mode|= MODE_INVALID_DATES;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment