mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-11060 sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed
In file sql/opt_range.cc,when calculate_cond_selectivity_for_table() is called with optimizer_use_condition_selectivity=4 then - thd->no_errors is set to 1 - the original value of thd->no_error is not restored to its original value - this is causing the assertion to fail in the subsequent queries Fixed by restoring the original value of thd->no_errors
This commit is contained in:
@ -1670,6 +1670,26 @@ DROP TABLE t1,t2;
|
|||||||
#
|
#
|
||||||
# End of 10.0 tests
|
# End of 10.0 tests
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
# Start of 10.1 tests
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# MDEV-11060: sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed
|
||||||
|
#
|
||||||
|
set optimizer_use_condition_selectivity=4;
|
||||||
|
drop view if exists v1;
|
||||||
|
create table t1 (a int not null, b int, c int) engine=InnoDB;
|
||||||
|
create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c);
|
||||||
|
create table t2 (d int, e int) engine=InnoDB;
|
||||||
|
update t1, t2 set a=NULL, b=2, c=NULL where b=d and e=200;
|
||||||
|
create view v1 as select * from t1, t2 where d=2;
|
||||||
|
insert v1 (a,c) values (NULL, 20);
|
||||||
|
ERROR 23000: Column 'a' cannot be null
|
||||||
|
drop table t1,t2;
|
||||||
|
drop view v1;
|
||||||
|
#
|
||||||
|
# End of 10.1 tests
|
||||||
|
#
|
||||||
set use_stat_tables= @tmp_ust;
|
set use_stat_tables= @tmp_ust;
|
||||||
set optimizer_use_condition_selectivity= @tmp_oucs;
|
set optimizer_use_condition_selectivity= @tmp_oucs;
|
||||||
SET SESSION STORAGE_ENGINE=DEFAULT;
|
SET SESSION STORAGE_ENGINE=DEFAULT;
|
||||||
|
@ -138,6 +138,39 @@ DROP TABLE t1,t2;
|
|||||||
--echo # End of 10.0 tests
|
--echo # End of 10.0 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Start of 10.1 tests
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-11060: sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
|
||||||
|
set optimizer_use_condition_selectivity=4;
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
drop view if exists v1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
create table t1 (a int not null, b int, c int) engine=InnoDB;
|
||||||
|
create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c);
|
||||||
|
|
||||||
|
create table t2 (d int, e int) engine=InnoDB;
|
||||||
|
update t1, t2 set a=NULL, b=2, c=NULL where b=d and e=200;
|
||||||
|
|
||||||
|
create view v1 as select * from t1, t2 where d=2;
|
||||||
|
--error ER_BAD_NULL_ERROR
|
||||||
|
insert v1 (a,c) values (NULL, 20);
|
||||||
|
|
||||||
|
drop table t1,t2;
|
||||||
|
drop view v1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of 10.1 tests
|
||||||
|
--echo #
|
||||||
|
|
||||||
set use_stat_tables= @tmp_ust;
|
set use_stat_tables= @tmp_ust;
|
||||||
set optimizer_use_condition_selectivity= @tmp_oucs;
|
set optimizer_use_condition_selectivity= @tmp_oucs;
|
||||||
SET SESSION STORAGE_ENGINE=DEFAULT;
|
SET SESSION STORAGE_ENGINE=DEFAULT;
|
||||||
|
@ -3112,6 +3112,7 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free_alloc:
|
free_alloc:
|
||||||
|
thd->no_errors= 0;
|
||||||
thd->mem_root= param.old_root;
|
thd->mem_root= param.old_root;
|
||||||
free_root(&alloc, MYF(0));
|
free_root(&alloc, MYF(0));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user