diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 05534eb717e4bd3f22b195ca8f42cd08fa9e00be..27f00e8c5b1558df81e71e2140916a9ccbf8857a 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1040,7 +1040,8 @@ Sql_condition* THD::raise_condition(uint sql_errno,
     level= Sql_condition::WARN_LEVEL_ERROR;
   }
 
-  if (handle_condition(sql_errno, sqlstate, &level, msg, &cond))
+  if (!is_fatal_error &&
+      handle_condition(sql_errno, sqlstate, &level, msg, &cond))
     DBUG_RETURN(cond);
 
   switch (level) {
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 8683368e818d858d67a79857094ade7e46cf3c2f..a9b6ba222f953948599f44ab87ae85d90afdb904 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -3334,7 +3334,6 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
 {
   TABLE_LIST stat_tables[STATISTICS_TABLES];
   Open_tables_backup open_tables_backup;
-  bool has_error_active= thd->is_error();
   DBUG_ENTER("read_statistics_for_tables_if_needed");
 
   DEBUG_SYNC(thd, "statistics_read_start");
@@ -3343,11 +3342,7 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
     DBUG_RETURN(0);
 
   if (open_stat_tables(thd, stat_tables, &open_tables_backup, FALSE))
-  {
-    if (!has_error_active)
-      thd->clear_error();
     DBUG_RETURN(1);
-  }
 
   for (TABLE_LIST *tl= tables; tl; tl= tl->next_global)
   {
@@ -3416,15 +3411,10 @@ int delete_statistics_for_table(THD *thd, const LEX_CSTRING *db,
   TABLE_LIST tables[STATISTICS_TABLES];
   Open_tables_backup open_tables_backup;
   int rc= 0;
-  bool has_error_active= thd->is_error();
   DBUG_ENTER("delete_statistics_for_table");
    
   if (open_stat_tables(thd, tables, &open_tables_backup, TRUE))
-  {
-    if (!has_error_active)
-      thd->clear_error();
     DBUG_RETURN(0);
-  }
 
   save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
 
@@ -3506,16 +3496,11 @@ int delete_statistics_for_column(THD *thd, TABLE *tab, Field *col)
   TABLE_LIST tables;
   Open_tables_backup open_tables_backup;
   int rc= 0;
-  bool has_error_active= thd->is_error();
   DBUG_ENTER("delete_statistics_for_column");
    
   if (open_single_stat_table(thd, &tables, &stat_table_name[1],
                              &open_tables_backup, TRUE))
-  {
-    if (!has_error_active)
-      thd->clear_error();
     DBUG_RETURN(0);
-  }
 
   save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
 
@@ -3574,16 +3559,11 @@ int delete_statistics_for_index(THD *thd, TABLE *tab, KEY *key_info,
   TABLE_LIST tables;
   Open_tables_backup open_tables_backup;
   int rc= 0;
-  bool has_error_active= thd->is_error();
   DBUG_ENTER("delete_statistics_for_index");
    
   if (open_single_stat_table(thd, &tables, &stat_table_name[2],
 			     &open_tables_backup, TRUE))
-  {
-    if (!has_error_active)
-      thd->clear_error();
     DBUG_RETURN(0);
-  }
 
   save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
 
@@ -3760,7 +3740,6 @@ int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col,
   TABLE_LIST tables;
   Open_tables_backup open_tables_backup;
   int rc= 0;
-  bool has_error_active= thd->is_error();
   DBUG_ENTER("rename_column_in_stat_tables");
   
   if (tab->s->tmp_table != NO_TMP_TABLE)
@@ -3768,11 +3747,7 @@ int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col,
 
   if (open_single_stat_table(thd, &tables, &stat_table_name[1],
                              &open_tables_backup, TRUE))
-  {
-    if (!has_error_active)
-      thd->clear_error();
     DBUG_RETURN(rc);
-  }
 
   save_binlog_format= thd->set_current_stmt_binlog_format_stmt();