diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-10-06 11:09:18 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-10-06 11:09:18 +0400 |
commit | b988331b71efbb75b58d10ee3c10b08d0f670394 (patch) | |
tree | 42369c16e0ab0a64df324e22fc20b723cf983320 | |
parent | 30df032e28bada8aabc1c850799795c728cd96b7 (diff) | |
download | mariadb-git-b988331b71efbb75b58d10ee3c10b08d0f670394.tar.gz |
MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref ...
- Only allow basic constants as SHOW EXPLAIN arguments.
-rw-r--r-- | mysql-test/r/show_explain.result | 7 | ||||
-rw-r--r-- | mysql-test/t/show_explain.test | 8 | ||||
-rw-r--r-- | sql/sql_parse.cc | 3 |
3 files changed, 15 insertions, 3 deletions
diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result index b5eda0b30c8..bf96ad88f23 100644 --- a/mysql-test/r/show_explain.result +++ b/mysql-test/r/show_explain.result @@ -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); update t1 set b=a, c=a, filler='fooo'; 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 show explain for (select max(a) from t0); ERROR HY000: You may only use constant expressions in this statement @@ -1069,5 +1069,10 @@ a 2 set debug_dbug=''; 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 drop table t0; diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test index 8bfeae7e7e5..c2429b82d0c 100644 --- a/mysql-test/t/show_explain.test +++ b/mysql-test/t/show_explain.test @@ -43,7 +43,7 @@ alter table t1 add key(a), add key(b); # Try killing a non-existent thread # --error ER_NO_SUCH_THREAD -show explain for 2*1000*1000*1000; +show explain for 2000000000; --error ER_SET_CONSTANTS_ONLY show explain for (select max(a) from t0); @@ -1105,5 +1105,11 @@ reap; set debug_dbug=''; 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 drop table t0; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3c697cb43af..217b60faa57 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2159,7 +2159,8 @@ mysql_execute_command(THD *thd) } 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)) { my_message(ER_SET_CONSTANTS_ONLY, ER(ER_SET_CONSTANTS_ONLY), |