mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-6393: ANALYZE SELECT crashes ... Don't try printing EXPLAIN if we had an error.
This commit is contained in:
@ -197,3 +197,21 @@ select * from t1;
|
||||
a b
|
||||
6 6
|
||||
drop table t0, t1;
|
||||
#
|
||||
# MDEV-6393: ANALYZE SELECT crashes in Explain_query::print_explain with a non-existing column
|
||||
#
|
||||
create table t1 (i int);
|
||||
insert into t1 values (1),(2);
|
||||
analyze select a from t1;
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
analyze delete from t1 where a=2;
|
||||
ERROR 42S22: Unknown column 'a' in 'where clause'
|
||||
analyze update t1 set a=2;
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
analyze update t2,t1 set t2.i=5 where t2.a=t1.a;
|
||||
ERROR 42S22: Unknown column 't2.a' in 'where clause'
|
||||
analyze delete t1 from t2,t1 where t2.a=t1.a;
|
||||
ERROR 42S22: Unknown column 't2.a' in 'where clause'
|
||||
drop table t1,t2;
|
||||
|
@ -146,3 +146,28 @@ select * from t1;
|
||||
|
||||
drop table t0, t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-6393: ANALYZE SELECT crashes in Explain_query::print_explain with a non-existing column
|
||||
--echo #
|
||||
create table t1 (i int);
|
||||
insert into t1 values (1),(2);
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
analyze select a from t1;
|
||||
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
analyze delete from t1 where a=2;
|
||||
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
analyze update t1 set a=2;
|
||||
|
||||
create table t2 like t1;
|
||||
insert into t2 select * from t1;
|
||||
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
analyze update t2,t1 set t2.i=5 where t2.a=t1.a;
|
||||
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
analyze delete t1 from t2,t1 where t2.a=t1.a;
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
|
@ -5282,7 +5282,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
|
||||
return 1;
|
||||
delete thd->protocol;
|
||||
thd->protocol= save_protocol;
|
||||
thd->lex->explain->send_explain(thd);
|
||||
if (!res)
|
||||
thd->lex->explain->send_explain(thd);
|
||||
|
||||
if (result != lex->result)
|
||||
delete result;
|
||||
|
Reference in New Issue
Block a user