diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 35b76a8ab4b..9e9b9ef9a87 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1270,3 +1270,9 @@ s1 7 drop view v1; drop table t1; +create table t1 (s1 int); +create view v1 as select * from t1; +handler v1 open as xx; +ERROR HY000: 'test.v1' is not BASE TABLE +drop view v1; +drop table t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 9464e291e05..d47de266c5e 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1230,3 +1230,13 @@ insert into v1 values (1) on duplicate key update s1 = 7; select * from t1; drop view v1; drop table t1; + +# +# HANDLER with VIEW +# +create table t1 (s1 int); +create view v1 as select * from t1; +-- error 1346 +handler v1 open as xx; +drop view v1; +drop table t1; diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 0df3d617d7f..4dc76ed6981 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -51,7 +51,11 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables) { HANDLER_TABLES_HACK(thd); uint counter; + + /* for now HANDLER can be used only for real TABLES */ + tables->required_type= FRMTYPE_TABLE; int err=open_tables(thd, tables, &counter); + HANDLER_TABLES_HACK(thd); if (err) return -1;