diff options
-rw-r--r-- | mysql-test/include/handler.inc | 19 | ||||
-rw-r--r-- | mysql-test/r/handler_myisam.result | 13 | ||||
-rw-r--r-- | sql/sql_handler.cc | 6 |
3 files changed, 35 insertions, 3 deletions
diff --git a/mysql-test/include/handler.inc b/mysql-test/include/handler.inc index a5b8c6cc7c9..437dd6ced4d 100644 --- a/mysql-test/include/handler.inc +++ b/mysql-test/include/handler.inc @@ -479,3 +479,22 @@ handler t1 open; --echo --> client 1 connection default; drop table t1; + +# +# Bug#30632 HANDLER read failure causes hang +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int); +handler t1 open as t1_alias; +--error 1176 +handler t1_alias read a next; +--error 1054 +handler t1_alias READ a next where inexistent > 0; +--error 1176 +handler t1_alias read a next; +--error 1054 +handler t1_alias READ a next where inexistent > 0; +handler t1_alias close; +drop table t1; diff --git a/mysql-test/r/handler_myisam.result b/mysql-test/r/handler_myisam.result index 5d04604959b..5a9b2824232 100644 --- a/mysql-test/r/handler_myisam.result +++ b/mysql-test/r/handler_myisam.result @@ -522,3 +522,16 @@ handler t1 open; ERROR HY000: Table storage engine for 't1' doesn't have this option --> client 1 drop table t1; +drop table if exists t1; +create table t1 (a int); +handler t1 open as t1_alias; +handler t1_alias read a next; +ERROR HY000: Key 'a' doesn't exist in table 't1_alias' +handler t1_alias READ a next where inexistent > 0; +ERROR 42S22: Unknown column 'inexistent' in 'field list' +handler t1_alias read a next; +ERROR HY000: Key 'a' doesn't exist in table 't1_alias' +handler t1_alias READ a next where inexistent > 0; +ERROR 42S22: Unknown column 'inexistent' in 'field list' +handler t1_alias close; +drop table t1; diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index bd3a53c5f1e..3ba41959ed1 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -444,7 +444,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, cond->cleanup(); // File was reopened if ((!cond->fixed && cond->fix_fields(thd, &cond)) || cond->check_cols(1)) - goto err0; + goto err; } if (keyname) @@ -452,13 +452,13 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, if ((keyno=find_type(keyname, &table->s->keynames, 1+2)-1)<0) { my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias); - goto err0; + goto err; } } if (insert_fields(thd, &thd->lex->select_lex.context, tables->db, tables->alias, &it, 0)) - goto err0; + goto err; protocol->send_fields(&list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF); |