MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:mhansson Date:June 19 2007 12:38pm
Subject:bk commit into 5.1 tree (mhansson:1.2562) BUG#28677
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of martin. When martin does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-19 15:37:52+03:00, mhansson@stripped +1 -0
  Bug #28677: SELECT on missing column gives extra error
  Manual edit in order to merge from mysql-5.0 tree.

  sql/sql_insert.cc@stripped, 2007-06-19 15:37:47+03:00, mhansson@stripped +62 -50
    Bug#28677: Manual merge from 5.0:
    - moved everything beyond producing an error message out of select_insert::send_error 
      and into new override select_insert::abort() 
    - made corresponding move of code from select_create::send_error to

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mhansson
# Host:	linux-st28.site
# Root:	/home/martin/mysql/src/bug28677/my51-bug28677

--- 1.276/sql/sql_insert.cc	2007-06-18 17:21:30 +03:00
+++ 1.277/sql/sql_insert.cc	2007-06-19 15:37:47 +03:00
@@ -3014,57 +3014,8 @@ void select_insert::send_error(uint errc
 {
   DBUG_ENTER("select_insert::send_error");
 
-  /* Avoid an extra 'unknown error' message if we already reported an error */
-  if (errcode != ER_UNKNOWN_ERROR && !thd->net.report_error)
-    my_message(errcode, err, MYF(0));
+  my_message(errcode, err, MYF(0));
 
-  /*
-    If the creation of the table failed (due to a syntax error, for
-    example), no table will have been opened and therefore 'table'
-    will be NULL. In that case, we still need to execute the rollback
-    and the end of the function.
-   */
-  if (table)
-  {
-    /*
-      If we are not in prelocked mode, we end the bulk insert started
-      before.
-    */
-    if (!thd->prelocked_mode)
-      table->file->ha_end_bulk_insert();
-
-    /*
-      If at least one row has been inserted/modified and will stay in
-      the table (the table doesn't have transactions) we must write to
-      the binlog (and the error code will make the slave stop).
-
-      For many errors (example: we got a duplicate key error while
-      inserting into a MyISAM table), no row will be added to the table,
-      so passing the error to the slave will not help since there will
-      be an error code mismatch (the inserts will succeed on the slave
-      with no error).
-
-      If table creation failed, the number of rows modified will also be
-      zero, so no check for that is made.
-    */
-    if (info.copied || info.deleted || info.updated)
-    {
-      DBUG_ASSERT(table != NULL);
-      if (!table->file->has_transactions())
-      {
-        if (mysql_bin_log.is_open())
-          thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length,
-                            table->file->has_transactions(), FALSE);
-        if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table &&
-            !can_rollback_data())
-          thd->no_trans_update.all= TRUE;
-        query_cache_invalidate3(thd, table, 1);
-      }
-    }
-    table->file->ha_release_auto_increment();
-  }
-
-  ha_rollback_stmt(thd);
   DBUG_VOID_RETURN;
 }
 
@@ -3154,6 +3105,59 @@ bool select_insert::send_eof()
   DBUG_RETURN(0);
 }
 
+void select_insert::abort() {
+
+  DBUG_ENTER("select_insert::abort");
+  /*
+    If the creation of the table failed (due to a syntax error, for
+    example), no table will have been opened and therefore 'table'
+    will be NULL. In that case, we still need to execute the rollback
+    and the end of the function.
+   */
+  if (table)
+  {
+    /*
+      If we are not in prelocked mode, we end the bulk insert started
+      before.
+    */
+    if (!thd->prelocked_mode)
+      table->file->ha_end_bulk_insert();
+
+    /*
+      If at least one row has been inserted/modified and will stay in
+      the table (the table doesn't have transactions) we must write to
+      the binlog (and the error code will make the slave stop).
+
+      For many errors (example: we got a duplicate key error while
+      inserting into a MyISAM table), no row will be added to the table,
+      so passing the error to the slave will not help since there will
+      be an error code mismatch (the inserts will succeed on the slave
+      with no error).
+
+      If table creation failed, the number of rows modified will also be
+      zero, so no check for that is made.
+    */
+    if (info.copied || info.deleted || info.updated)
+    {
+      DBUG_ASSERT(table != NULL);
+      if (!table->file->has_transactions())
+      {
+        if (mysql_bin_log.is_open())
+          thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length,
+                            table->file->has_transactions(), FALSE);
+        if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table &&
+            !can_rollback_data())
+          thd->no_trans_update.all= TRUE;
+        query_cache_invalidate3(thd, table, 1);
+      }
+    }
+    table->file->ha_release_auto_increment();
+  }
+
+  ha_rollback_stmt(thd);
+  DBUG_VOID_RETURN;
+}
+
 
 /***************************************************************************
   CREATE TABLE (SELECT) ...
@@ -3571,6 +3575,14 @@ bool select_create::send_eof()
 void select_create::abort()
 {
   DBUG_ENTER("select_create::abort");
+
+  /*
+   Disable binlog, because we "roll back" partial inserts in ::abort
+   by removing the table, even for non-transactional tables.
+  */
+  tmp_disable_binlog(thd);
+  select_insert::abort();
+  reenable_binlog(thd);
 
   /*
     We roll back the statement, including truncating the transaction
Thread
bk commit into 5.1 tree (mhansson:1.2562) BUG#28677mhansson19 Jun