diff options
-rw-r--r-- | mysql-test/r/handler.result | 1 | ||||
-rw-r--r-- | mysql-test/t/handler.test | 2 | ||||
-rw-r--r-- | sql/sql_handler.cc | 5 |
3 files changed, 8 insertions, 0 deletions
diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result index cd39657c470..d495dde75bf 100644 --- a/mysql-test/r/handler.result +++ b/mysql-test/r/handler.result @@ -129,6 +129,7 @@ a b handler t2 read next; a b 18 eee +alter table t1 type=MyISAM; handler t2 read next; a b 19 fff diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test index 359c5641056..4f1b11c80ff 100644 --- a/mysql-test/t/handler.test +++ b/mysql-test/t/handler.test @@ -58,8 +58,10 @@ handler t2 read a=(19) where b="yyy"; handler t2 read first; handler t2 read next; +alter table t1 type=MyISAM; handler t2 read next; !$1064 handler t2 read last; handler t2 close; drop table if exists t1; + diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index f7effdc67e6..0c6b5599519 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -130,7 +130,11 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, select_limit+=offset_limit; send_fields(thd,list,1); + HANDLER_TABLES_HACK(thd); MYSQL_LOCK *lock=mysql_lock_tables(thd,&tables->table,1); + HANDLER_TABLES_HACK(thd); + if (!lock) + goto err0; // mysql_lock_tables() printed error message already for (uint num_rows=0; num_rows < select_limit; ) { @@ -238,6 +242,7 @@ ok: return 0; err: mysql_unlock_tables(thd,lock); +err0: return -1; } |