diff --git a/sql/table.cc b/sql/table.cc
index ab1bd49ba4868131ddc5b36ce9a2e6ee9d7e192e..a96ca0da881e3ad7048834754b54b840cfe35341 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1484,7 +1484,18 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
       tmp= fix_partition_func(thd, outparam, is_create_table);
     *root_ptr= old_root;
     if (tmp)
+    {
+      if (is_create_table)
+      {
+        /*
+          During CREATE/ALTER TABLE it is ok to receive errors here.
+          It is not ok if it happens during the opening of an frm
+          file as part of a normal query.
+        */
+        error_reported= TRUE;
+      }
       goto err;
+    }
   }
 #endif
 
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 11aa73bb5025a581b20670cd932bb4e66af341e4..42518e7b9b796fda3fb76248020a061d1ab05366 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -339,6 +339,7 @@ int rea_create_table(THD *thd, const char *path,
   DBUG_RETURN(0);
 
 err_handler:
+  VOID(file->create_handler_files(path, NULL, CHF_DELETE_FLAG, create_info));
   my_delete(frm_name, MYF(0));
   DBUG_RETURN(1);
 } /* rea_create_table */