Commit b988331b authored by Sergey Petrunya's avatar Sergey Petrunya

MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref ...

- Only allow basic constants as SHOW EXPLAIN arguments.
parent 30df032e
...@@ -7,7 +7,7 @@ insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C; ...@@ -7,7 +7,7 @@ insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C;
alter table t1 add b int, add c int, add filler char(32); alter table t1 add b int, add c int, add filler char(32);
update t1 set b=a, c=a, filler='fooo'; update t1 set b=a, c=a, filler='fooo';
alter table t1 add key(a), add key(b); alter table t1 add key(a), add key(b);
show explain for 2*1000*1000*1000; show explain for 2000000000;
ERROR HY000: Unknown thread id: 2000000000 ERROR HY000: Unknown thread id: 2000000000
show explain for (select max(a) from t0); show explain for (select max(a) from t0);
ERROR HY000: You may only use constant expressions in this statement ERROR HY000: You may only use constant expressions in this statement
...@@ -1069,5 +1069,10 @@ a ...@@ -1069,5 +1069,10 @@ a
2 2
set debug_dbug=''; set debug_dbug='';
set names default; set names default;
#
# MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value
#
show explain for foo;
ERROR HY000: You may only use constant expressions in this statement
# End # End
drop table t0; drop table t0;
...@@ -43,7 +43,7 @@ alter table t1 add key(a), add key(b); ...@@ -43,7 +43,7 @@ alter table t1 add key(a), add key(b);
# Try killing a non-existent thread # Try killing a non-existent thread
# #
--error ER_NO_SUCH_THREAD --error ER_NO_SUCH_THREAD
show explain for 2*1000*1000*1000; show explain for 2000000000;
--error ER_SET_CONSTANTS_ONLY --error ER_SET_CONSTANTS_ONLY
show explain for (select max(a) from t0); show explain for (select max(a) from t0);
...@@ -1105,5 +1105,11 @@ reap; ...@@ -1105,5 +1105,11 @@ reap;
set debug_dbug=''; set debug_dbug='';
set names default; set names default;
--echo #
--echo # MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value
--echo #
--error ER_SET_CONSTANTS_ONLY
show explain for foo;
--echo # End --echo # End
drop table t0; drop table t0;
...@@ -2159,7 +2159,8 @@ mysql_execute_command(THD *thd) ...@@ -2159,7 +2159,8 @@ mysql_execute_command(THD *thd)
} }
Item **it= lex->value_list.head_ref(); Item **it= lex->value_list.head_ref();
if ((!(*it)->fixed && (*it)->fix_fields(lex->thd, it)) || if (!(*it)->basic_const_item() ||
(!(*it)->fixed && (*it)->fix_fields(lex->thd, it)) ||
(*it)->check_cols(1)) (*it)->check_cols(1))
{ {
my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY), my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY),
......
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