diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index c429c45c389780754027a8549038934a3e0bf6f5..e4218ffe89fe829a91aac657d018da68c6589d07 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1036,3 +1036,9 @@ a
 4
 drop view v1;
 drop table t1;
+CREATE VIEW v02 AS SELECT * FROM DUAL;
+ERROR HY000: No tables used
+SHOW TABLES;
+Tables_in_test	table_type
+t2	BASE TABLE
+v4	VIEW
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index cefbb599d27255f3ea06b4e879f049a9e8c4159f..4e388c3fd28792237d7b29cd72587c3d2c617269 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -973,3 +973,10 @@ select * from t1;
 
 drop view v1;
 drop table t1;
+
+#
+# error on preparation
+#
+-- error 1096
+CREATE VIEW v02 AS SELECT * FROM DUAL;
+SHOW TABLES;
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 339e14d933391d8a43b3b0779f0016d49e5d6ef4..78fcac4ddcfccc884372d0cc12c0c812dd028c54 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -183,8 +183,15 @@ int mysql_create_view(THD *thd,
 
   // prepare select to resolve all fields
   lex->view_prepare_mode= 1;
-  if ((res= unit->prepare(thd, 0, 0)))
+  if (unit->prepare(thd, 0, 0))
+  {
+    /*
+      some errors from prepare are reported to user, if is not then
+      it will be checked after err: label
+    */
+    res= 1;
     goto err;
+  }
 
   /* view list (list of view fields names) */
   if (lex->view_list.elements)