List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:January 6 2006 6:43pm
Subject:bk commit into 5.1 tree (jimw:1.2047)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jimw. When jimw 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
  1.2047 06/01/06 10:42:58 jimw@stripped +28 -0
  Merge mysql.com:/home/jimw/my/mysql-5.0-clean
  into  mysql.com:/home/jimw/my/mysql-5.1-clean

  sql/log_event.cc
    1.193 06/01/06 10:42:54 jimw@stripped +0 -17
    Resolve conflict

  sql/ha_ndbcluster.cc
    1.229 06/01/06 10:42:54 jimw@stripped +0 -4
    Resolve conflict

  sql/field.cc
    1.296 06/01/06 10:42:54 jimw@stripped +0 -2
    Resolve conflict

  sql/sql_trigger.cc
    1.42 06/01/06 10:34:57 jimw@stripped +0 -1
    Auto merged

  sql/sql_select.cc
    1.381 06/01/06 10:34:57 jimw@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.503 06/01/06 10:34:57 jimw@stripped +0 -1
    Auto merged

  sql/sql_insert.cc
    1.184 06/01/06 10:34:57 jimw@stripped +0 -0
    Auto merged

  sql/sql_handler.cc
    1.78 06/01/06 10:34:57 jimw@stripped +0 -0
    Auto merged

  sql/sql_base.cc
    1.294 06/01/06 10:34:57 jimw@stripped +0 -0
    Auto merged

  sql/sql_acl.cc
    1.171 06/01/06 10:34:57 jimw@stripped +0 -0
    Auto merged

  sql/sp_head.h
    1.81 06/01/06 10:34:56 jimw@stripped +0 -0
    Auto merged

  sql/sp_head.cc
    1.209 06/01/06 10:34:56 jimw@stripped +0 -0
    Auto merged

  sql/sp.cc
    1.102 06/01/06 10:34:56 jimw@stripped +0 -0
    Auto merged

  sql/parse_file.cc
    1.20 06/01/06 10:34:56 jimw@stripped +0 -0
    Auto merged

  sql/opt_range.cc
    1.192 06/01/06 10:34:56 jimw@stripped +0 -0
    Auto merged

  sql/mysqld.cc
    1.513 06/01/06 10:34:56 jimw@stripped +0 -0
    Auto merged

  sql/item.h
    1.187 06/01/06 10:34:56 jimw@stripped +0 -0
    Auto merged

  sql/item.cc
    1.164 06/01/06 10:34:56 jimw@stripped +0 -0
    Auto merged

  sql/handler.cc
    1.204 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

  sql/ha_federated.cc
    1.47 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

  mysql-test/t/view.test
    1.131 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

  mysql-test/t/disabled.def
    1.33 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

  mysql-test/t/create.test
    1.74 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

  mysql-test/t/bdb.test
    1.52 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

  mysql-test/r/view.result
    1.143 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

  mysql-test/r/create.result
    1.112 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

  mysql-test/r/bdb.result
    1.50 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

  include/config-win.h
    1.76 06/01/06 10:34:55 jimw@stripped +0 -0
    Auto merged

# 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:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.1-clean/RESYNC

--- 1.203/sql/handler.cc	2006-01-06 03:21:09 -08:00
+++ 1.204/sql/handler.cc	2006-01-06 10:34:55 -08:00
@@ -2084,7 +2084,8 @@
       is an optimization hint that storage engine is free to ignore.
       So, let's commit an open transaction (if any) now.
     */
-    error= end_trans(thd, COMMIT);
+    if (!(error= ha_commit_stmt(thd)))
+      error= end_trans(thd, COMMIT);
   }
   DBUG_RETURN(error);
 }

--- 1.163/sql/item.cc	2005-12-27 18:43:32 -08:00
+++ 1.164/sql/item.cc	2006-01-06 10:34:56 -08:00
@@ -4925,6 +4925,12 @@
 }
 
 
+void Item_ref::save_org_in_field(Field *field)
+{
+  (*ref)->save_org_in_field(field);
+}
+
+
 void Item_ref::make_field(Send_field *field)
 {
   (*ref)->make_field(field);

--- 1.186/sql/item.h	2005-12-26 03:53:40 -08:00
+++ 1.187/sql/item.h	2006-01-06 10:34:56 -08:00
@@ -1782,11 +1782,7 @@
   void make_field(Send_field *field);
   bool fix_fields(THD *, Item **);
   int save_in_field(Field *field, bool no_conversions);
-  void save_org_in_field(Field *field)
-  {
-    (*ref)->save_org_in_field(field);
-    null_value= (*ref)->null_value;
-  }
+  void save_org_in_field(Field *field);
   enum Item_result result_type () const { return (*ref)->result_type(); }
   enum_field_types field_type() const   { return (*ref)->field_type(); }
   Field *get_tmp_table_field()

--- 1.192/sql/log_event.cc	2005-12-21 20:10:52 -08:00
+++ 1.193/sql/log_event.cc	2006-01-06 10:42:54 -08:00
@@ -118,13 +118,24 @@
 
 
 /*
-  slave_load_file_stem()
+  Creates a temporary name for load data infile:
+
+  SYNOPSIS
+    slave_load_file_stem()
+    buf		      Store new filename here
+    file_id	      File_id (part of file name)
+    event_server_id   Event_id (part of file name)
+    ext		      Extension for file name
+
+  RETURN
+    Pointer to start of extension
 */
 
 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
-static inline char* slave_load_file_stem(char*buf, uint file_id,
-					 int event_server_id)
+static char *slave_load_file_stem(char *buf, uint file_id,
+                                  int event_server_id, const char *ext)
 {
+  char *res;
   fn_format(buf,"SQL_LOAD-",slave_load_tmpdir, "", MY_UNPACK_FILENAME);
   to_unix_path(buf);
 
@@ -133,7 +144,9 @@
   *buf++ = '-';
   buf = int10_to_str(event_server_id, buf, 10);
   *buf++ = '-';
-  return int10_to_str(file_id, buf, 10);
+  res= int10_to_str(file_id, buf, 10);
+  strmov(res, ext);                             // Add extension last
+  return res;                                   // Pointer to extension
 }
 #endif
 
@@ -928,7 +941,6 @@
     /* Pretty-print event common header if header is exactly 19 bytes */
     if (print_event_info->common_header_len == LOG_EVENT_MINIMAL_HEADER_LEN)
     {
-      DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
       fprintf(file, "# Position  Timestamp   Type   Master ID        "
 	      "Size      Master Pos    Flags \n");
       fprintf(file, "# %8.8lx %02x %02x %02x %02x   %02x   "
@@ -954,7 +966,6 @@
 
       if (i % 16 == 15)
       {
-        DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
 	fprintf(file, "# %8.8lx %-48.48s |%16s|\n",
 		(unsigned long) (hexdump_from + (i & 0xfffffff0)),
                 hex_string, char_string);
@@ -968,12 +979,10 @@
     *c= '\0';
 
     /* Non-full last line */
-    if (hex_string[0]) {
-      DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
+    if (hex_string[0])
       fprintf(file, "# %8.8lx %-48.48s |%s|\n# ",
 	     (unsigned long) (hexdump_from + (i & 0xfffffff0)),
              hex_string, char_string);
-    }
   }
 }
 
@@ -4238,16 +4247,15 @@
 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
 int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
 {
-  char proc_info[17+FN_REFLEN+10], *fname_buf= proc_info+17;
-  char *p;
+  char proc_info[17+FN_REFLEN+10], *fname_buf;
+  char *ext;
   int fd = -1;
   IO_CACHE file;
   int error = 1;
 
   bzero((char*)&file, sizeof(file));
-  p = slave_load_file_stem(fname_buf, file_id, server_id);
-  strmov(p, ".info");			// strmov takes less code than memcpy
-  strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0
+  fname_buf= strmov(proc_info, "Making temp file ");
+  ext= slave_load_file_stem(fname_buf, file_id, server_id, ".info");
   thd->proc_info= proc_info;
   my_delete(fname_buf, MYF(0)); // old copy may exist already
   if ((fd= my_create(fname_buf, CREATE_MODE,
@@ -4262,12 +4270,11 @@
   }
   
   // a trick to avoid allocating another buffer
-  strmov(p, ".data");
-  fname = fname_buf;
-  fname_len = (uint)(p-fname) + 5;
+  fname= fname_buf;
+  fname_len= (uint) (strmov(ext, ".data") - fname);
   if (write_base(&file))
   {
-    strmov(p, ".info"); // to have it right in the error message
+    strmov(ext, ".info"); // to have it right in the error message
     slave_print_msg(ERROR_LEVEL, rli, my_errno,
                     "Error in Create_file event: could not write to file '%s'",
                     fname_buf);
@@ -4413,13 +4420,12 @@
 int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
 {
   char proc_info[17+FN_REFLEN+10], *fname= proc_info+17;
-  char *p= slave_load_file_stem(fname, file_id, server_id);
   int fd;
   int error = 1;
   DBUG_ENTER("Append_block_log_event::exec_event");
 
-  memcpy(p, ".data", 6);
-  strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0
+  fname= strmov(proc_info, "Making temp file ");
+  slave_load_file_stem(fname, file_id, server_id, ".data");
   thd->proc_info= proc_info;
   if (get_create_or_append())
   {
@@ -4545,10 +4551,9 @@
 int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
 {
   char fname[FN_REFLEN+10];
-  char *p= slave_load_file_stem(fname, file_id, server_id);
-  memcpy(p, ".data", 6);
+  char *ext= slave_load_file_stem(fname, file_id, server_id, ".data");
   (void) my_delete(fname, MYF(MY_WME));
-  memcpy(p, ".info", 6);
+  strmov(ext, ".info");
   (void) my_delete(fname, MYF(MY_WME));
   return Log_event::exec_event(rli);
 }
@@ -4641,13 +4646,13 @@
 int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
 {
   char fname[FN_REFLEN+10];
-  char *p= slave_load_file_stem(fname, file_id, server_id);
+  char *ext;
   int fd;
-  int error = 1;
+  int error= 1;
   IO_CACHE file;
-  Load_log_event* lev = 0;
+  Load_log_event *lev= 0;
 
-  memcpy(p, ".info", 6);
+  ext= slave_load_file_stem(fname, file_id, server_id, ".info");
   if ((fd = my_open(fname, O_RDONLY | O_BINARY | O_NOFOLLOW,
                     MYF(MY_WME))) < 0 ||
       init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0,
@@ -4708,7 +4713,7 @@
     fd= -1;
   }
   (void) my_delete(fname, MYF(MY_WME));
-  memcpy(p, ".data", 6);
+  memcpy(ext, ".data", 6);
   (void) my_delete(fname, MYF(MY_WME));
   error = 0;
 
@@ -4906,11 +4911,10 @@
   memcpy(p, query, fn_pos_start);
   p+= fn_pos_start;
   fname= (p= strmake(p, STRING_WITH_LEN(" INFILE \'")));
-  p= slave_load_file_stem(p, file_id, server_id);
-  fname_end= (p= strmake(p, STRING_WITH_LEN(".data")));
+  p= slave_load_file_stem(p, file_id, server_id, ".data");
+  fname_end= p= strend(p);                      // Safer than p=p+5
   *(p++)='\'';
-  switch (dup_handling)
-  {
+  switch (dup_handling) {
   case LOAD_DUP_IGNORE:
     p= strmake(p, STRING_WITH_LEN(" IGNORE"));
     break;

--- 1.512/sql/mysqld.cc	2006-01-05 01:54:09 -08:00
+++ 1.513/sql/mysqld.cc	2006-01-06 10:34:56 -08:00
@@ -1701,7 +1701,7 @@
       wake_thread--;
       thd=thread_cache.get();
       thd->real_id=pthread_self();
-      thd->thread_stack= (char *) &thd;
+      thd->thread_stack= (char*) &thd;          // For store_globals
       (void) thd->store_globals();
       thd->thr_create_time= time(NULL);
       threads.append(thd);

--- 1.191/sql/opt_range.cc	2005-12-25 22:46:16 -08:00
+++ 1.192/sql/opt_range.cc	2006-01-06 10:34:56 -08:00
@@ -6955,6 +6955,7 @@
 
 /*
   Create quick select from ref/ref_or_null scan.
+
   SYNOPSIS
     get_quick_select_for_ref()
       thd      Thread handle
@@ -6974,15 +6975,18 @@
 QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
                                              TABLE_REF *ref, ha_rows records)
 {
-  MEM_ROOT *old_root= thd->mem_root;
-  /* The following call may change thd->mem_root */
-  QUICK_RANGE_SELECT *quick= new QUICK_RANGE_SELECT(thd, table, ref->key, 0);
-  /* save mem_root set by QUICK_RANGE_SELECT constructor */
-  MEM_ROOT *alloc= thd->mem_root;
+  MEM_ROOT *old_root, *alloc;
+  QUICK_RANGE_SELECT *quick;
   KEY *key_info = &table->key_info[ref->key];
   KEY_PART *key_part;
   QUICK_RANGE *range;
   uint part;
+
+  old_root= thd->mem_root;
+  /* The following call may change thd->mem_root */
+  quick= new QUICK_RANGE_SELECT(thd, table, ref->key, 0);
+  /* save mem_root set by QUICK_RANGE_SELECT constructor */
+  alloc= thd->mem_root;
   /*
     return back default mem_root (thd->mem_root) changed by
     QUICK_RANGE_SELECT constructor

--- 1.170/sql/sql_acl.cc	2006-01-04 13:36:22 -08:00
+++ 1.171/sql/sql_acl.cc	2006-01-06 10:34:57 -08:00
@@ -3564,7 +3564,7 @@
     of other queries). For simple queries first_not_own_table is 0.
   */
   for (i= 0, table= tables;
-       table && table != first_not_own_table && i < number;
+       table != first_not_own_table && i < number;
        table= table->next_global, i++)
   {
     /* Remove SHOW_VIEW_ACL, because it will be checked during making view */

--- 1.183/sql/sql_insert.cc	2005-12-28 08:47:55 -08:00
+++ 1.184/sql/sql_insert.cc	2006-01-06 10:34:57 -08:00
@@ -2529,7 +2529,11 @@
   }
 
   /* First field to copy */
-  field=table->field+table->s->fields - values.elements;
+  field= table->field+table->s->fields - values.elements;
+
+  /* Mark all fields that are given values */
+  for (Field **f= field ; *f ; f++)
+    (*f)->query_id= thd->query_id;
 
   /* Don't set timestamp if used */
   table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;

--- 1.502/sql/sql_parse.cc	2005-12-28 08:47:55 -08:00
+++ 1.503/sql/sql_parse.cc	2006-01-06 10:34:57 -08:00
@@ -4856,7 +4856,6 @@
   if (thd->one_shot_set && lex->sql_command != SQLCOM_SET_OPTION)
     reset_one_shot_variables(thd);
 
-
   /*
     The return value for ROW_COUNT() is "implementation dependent" if the
     statement is not DELETE, INSERT or UPDATE, but -1 is what JDBC and ODBC
@@ -4868,13 +4867,10 @@
   if (lex->sql_command != SQLCOM_CALL && lex->sql_command != SQLCOM_EXECUTE &&
       uc_update_queries[lex->sql_command]<2)
     thd->row_count_func= -1;
-  goto cleanup;
+  DBUG_RETURN(res || thd->net.report_error);
 
 error:
-  res= 1;
-
-cleanup:
-  DBUG_RETURN(res || thd->net.report_error);
+  DBUG_RETURN(1);
 }
 
 
@@ -5097,7 +5093,7 @@
     the given table list refers to the list for prelocking (contains tables
     of other queries). For simple queries first_not_own_table is 0.
   */
-  for (; tables && tables != first_not_own_table; tables= tables->next_global)
+  for (; tables != first_not_own_table; tables= tables->next_global)
   {
     if (tables->schema_table && 
         (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
@@ -7263,7 +7259,7 @@
 
   /* Create and initialize. */
 
-  if (! (definer= (LEX_USER*) thd->alloc(sizeof (LEX_USER))))
+  if (! (definer= (LEX_USER*) thd->alloc(sizeof(LEX_USER))))
     return 0;
 
   definer->user= *user_name;

--- 1.380/sql/sql_select.cc	2005-12-26 08:45:58 -08:00
+++ 1.381/sql/sql_select.cc	2006-01-06 10:34:57 -08:00
@@ -10772,7 +10772,7 @@
     item->save_org_in_field(group->field);
     /* Store in the used key if the field was 0 */
     if (item->maybe_null)
-      group->buff[-1]=item->null_value ? 1 : 0;
+      group->buff[-1]= (char) group->field->is_null();
   }
   if (!table->file->index_read(table->record[1],
 			       join->tmp_table_param.group_buff,0,

--- 1.142/mysql-test/r/view.result	2005-12-24 09:06:16 -08:00
+++ 1.143/mysql-test/r/view.result	2006-01-06 10:34:55 -08:00
@@ -2423,6 +2423,9 @@
 drop table t1;
 create table t1(f1 int, f2 int);
 insert into t1 values (null, 10), (null,2);
+select f1, sum(f2) from t1 group by f1;
+f1	sum(f2)
+NULL	12
 create view v1 as select * from t1;
 select f1, sum(f2) from v1 group by f1;
 f1	sum(f2)

--- 1.130/mysql-test/t/view.test	2005-12-24 09:06:16 -08:00
+++ 1.131/mysql-test/t/view.test	2006-01-06 10:34:55 -08:00
@@ -2279,6 +2279,7 @@
 #
 create table t1(f1 int, f2 int);
 insert into t1 values (null, 10), (null,2);
+select f1, sum(f2) from t1 group by f1;
 create view v1 as select * from t1;
 select f1, sum(f2) from v1 group by f1;
 drop view v1;

--- 1.19/sql/parse_file.cc	2005-12-30 20:54:25 -08:00
+++ 1.20/sql/parse_file.cc	2006-01-06 10:34:56 -08:00
@@ -956,6 +956,6 @@
                                                char *end)
 {
   DBUG_ENTER("file_parser_dummy_hook::process_unknown_string");
-  DBUG_PRINT("info", ("unknown key:%60s", unknown_key));
+  DBUG_PRINT("info", ("Unknown key: '%60s'", unknown_key));
   DBUG_RETURN(FALSE);
 }

--- 1.41/sql/sql_trigger.cc	2005-12-30 20:54:42 -08:00
+++ 1.42/sql/sql_trigger.cc	2006-01-06 10:34:57 -08:00
@@ -51,6 +51,13 @@
   { { 0, 0 }, 0, FILE_OPTIONS_STRING }
 };
 
+File_option sql_modes_parameters=
+{
+  {(char*) STRING_WITH_LEN("sql_modes") },
+  offsetof(class Table_triggers_list, definition_modes_list),
+  FILE_OPTIONS_ULLLIST
+};
+
 /*
   This must be kept up to date whenever a new option is added to the list
   above, as it specifies the number of required parameters of the trigger in
@@ -435,7 +442,7 @@
 
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
   if (!is_acl_user(lex->definer->host.str,
-      lex->definer->user.str))
+                   lex->definer->user.str))
   {
     push_warning_printf(thd,
                         MYSQL_ERROR::WARN_LEVEL_NOTE,
@@ -1161,7 +1168,7 @@
     
     if (is_special_var_used(event, time_type))
     {
-      TABLE_LIST table_list;
+      TABLE_LIST table_list, **save_query_tables_own_last;
       bzero((char *) &table_list, sizeof (table_list));
       table_list.db= (char *) table->s->db.str;
       table_list.db_length= table->s->db.length;
@@ -1169,8 +1176,13 @@
       table_list.table_name_length= table->s->table_name.length;
       table_list.alias= (char *) table->alias;
       table_list.table= table;
+      save_query_tables_own_last= thd->lex->query_tables_own_last;
+      thd->lex->query_tables_own_last= 0;
 
-      if (check_table_access(thd, SELECT_ACL | UPDATE_ACL, &table_list, 0))
+      err_status= check_table_access(thd, SELECT_ACL | UPDATE_ACL,
+                                     &table_list, 0);
+      thd->lex->query_tables_own_last= save_query_tables_own_last;
+      if (err_status)
       {
         sp_restore_security_context(thd, save_ctx);
         return TRUE;
@@ -1212,32 +1224,29 @@
     TRUE  Error
 */
 
+#define INVALID_SQL_MODES_LENGTH 13
+
 bool
 Handle_old_incorrect_sql_modes_hook::process_unknown_string(char *&unknown_key,
                                                             gptr base,
                                                             MEM_ROOT *mem_root,
                                                             char *end)
 {
-#define INVALID_SQL_MODES_LENGTH 13
   DBUG_ENTER("handle_old_incorrect_sql_modes");
   DBUG_PRINT("info", ("unknown key:%60s", unknown_key));
+
   if (unknown_key + INVALID_SQL_MODES_LENGTH + 1 < end &&
       unknown_key[INVALID_SQL_MODES_LENGTH] == '=' &&
       !memcmp(unknown_key, STRING_WITH_LEN("sql_modes")))
   {
+    char *ptr= unknown_key + INVALID_SQL_MODES_LENGTH + 1;
+
     DBUG_PRINT("info", ("sql_modes affected by BUG#14090 detected"));
     push_warning_printf(current_thd,
                         MYSQL_ERROR::WARN_LEVEL_NOTE,
                         ER_OLD_FILE_FORMAT,
                         ER(ER_OLD_FILE_FORMAT),
                         (char *)path, "TRIGGER");
-    File_option sql_modes_parameters=
-      {
-        {(char *) STRING_WITH_LEN("sql_modes") },
-        offsetof(class Table_triggers_list, definition_modes_list),
-        FILE_OPTIONS_ULLLIST
-      };
-    char *ptr= unknown_key + INVALID_SQL_MODES_LENGTH + 1;
     if (get_file_options_ulllist(ptr, end, unknown_key, base,
                                  &sql_modes_parameters, mem_root))
     {

--- 1.32/mysql-test/t/disabled.def	2006-01-06 03:40:00 -08:00
+++ 1.33/mysql-test/t/disabled.def	2006-01-06 10:34:55 -08:00
@@ -11,7 +11,6 @@
 ##############################################################################
 
 sp-goto         : GOTO is currently is disabled - will be fixed in the future
-kill            : Unstable test case, bug#9712
 rpl_bit_npk     : Bug #13418
 ndb_cache2      : Bug #15004
 ndb_cache_multi2: Bug #15004

--- 1.228/sql/ha_ndbcluster.cc	2005-12-30 20:53:52 -08:00
+++ 1.229/sql/ha_ndbcluster.cc	2006-01-06 10:42:54 -08:00
@@ -370,7 +370,8 @@
   if (ndb)
   {
 #ifndef DBUG_OFF
-    Ndb::Free_list_usage tmp; tmp.m_name= 0;
+    Ndb::Free_list_usage tmp;
+    tmp.m_name= 0;
     while (ndb->get_free_list_usage(&tmp))
     {
       uint leaked= (uint) tmp.m_created - tmp.m_free;
@@ -382,8 +383,8 @@
     }
 #endif
     delete ndb;
+    ndb= NULL;
   }
-  ndb= NULL;
   changed_tables.empty();
 }
 
@@ -3359,6 +3360,10 @@
   if (lock_type != F_UNLCK)
   {
     DBUG_PRINT("info", ("lock_type != F_UNLCK"));
+    if (!thd->transaction.on)
+      m_transaction_on= FALSE;
+    else
+      m_transaction_on= thd->variables.ndb_use_transactions;
     if (!thd_ndb->lock_count++)
     {
       PRINT_OPTION_FLAGS(thd);
@@ -3373,7 +3378,8 @@
           ERR_RETURN(ndb->getNdbError());
         no_uncommitted_rows_reset(thd);
         thd_ndb->stmt= trans;
-        trans_register_ha(thd, FALSE, &ndbcluster_hton);
+        if (m_transaction_on)
+          trans_register_ha(thd, FALSE, &ndbcluster_hton);
       } 
       else 
       { 
@@ -3388,7 +3394,8 @@
             ERR_RETURN(ndb->getNdbError());
           no_uncommitted_rows_reset(thd);
           thd_ndb->all= trans; 
-          trans_register_ha(thd, TRUE, &ndbcluster_hton);
+          if (m_transaction_on)
+            trans_register_ha(thd, TRUE, &ndbcluster_hton);
 
           /*
             If this is the start of a LOCK TABLE, a table look 
@@ -3422,10 +3429,6 @@
     m_ha_not_exact_count= !thd->variables.ndb_use_exact_count;
     m_autoincrement_prefetch= 
       (ha_rows) thd->variables.ndb_autoincrement_prefetch_sz;
-    if (!thd->transaction.on)
-      m_transaction_on= FALSE;
-    else
-      m_transaction_on= thd->variables.ndb_use_transactions;
 
     m_active_trans= thd_ndb->all ? thd_ndb->all : thd_ndb->stmt;
     DBUG_ASSERT(m_active_trans);
@@ -5172,7 +5175,8 @@
   if (g_ndb)
   {
 #ifndef DBUG_OFF
-    Ndb::Free_list_usage tmp; tmp.m_name= 0;
+    Ndb::Free_list_usage tmp;
+    tmp.m_name= 0;
     while (g_ndb->get_free_list_usage(&tmp))
     {
       uint leaked= (uint) tmp.m_created - tmp.m_free;
@@ -5184,10 +5188,9 @@
     }
 #endif
     delete g_ndb;
+    g_ndb= NULL;
   }
-  g_ndb= NULL;
-  if (g_ndb_cluster_connection)
-    delete g_ndb_cluster_connection;
+  delete g_ndb_cluster_connection;
   g_ndb_cluster_connection= NULL;
 
   hash_free(&ndbcluster_open_tables);
@@ -8075,7 +8078,8 @@
   if (get_thd_ndb(thd) && get_thd_ndb(thd)->ndb)
   {
     Ndb* ndb= (get_thd_ndb(thd))->ndb;
-    Ndb::Free_list_usage tmp; tmp.m_name= 0;
+    Ndb::Free_list_usage tmp;
+    tmp.m_name= 0;
     while (ndb->get_free_list_usage(&tmp))
     {
       uint buflen=

--- 1.111/mysql-test/r/create.result	2005-12-30 20:51:16 -08:00
+++ 1.112/mysql-test/r/create.result	2006-01-06 10:34:55 -08:00
@@ -279,7 +279,6 @@
 create table if not exists t1 select 3 as 'a',4 as 'b';
 Warnings:
 Note	1050	Table 't1' already exists
-Warning	1364	Field 'a' doesn't have a default value
 create table if not exists t1 select 3 as 'a',3 as 'b';
 ERROR 23000: Duplicate entry '3' for key 1
 select * from t1;
@@ -635,8 +634,6 @@
 a varchar(112) charset utf8 collate utf8_bin not null,
 primary key (a)
 ) select 'test' as a ;
-Warnings:
-Warning	1364	Field 'a' doesn't have a default value
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
@@ -652,14 +649,39 @@
 a varchar(12) charset utf8 collate utf8_bin not null, 
 b int not null, primary key (a)
 ) select a, 1 as b from t2 ;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
+  `b` int(11) NOT NULL,
+  PRIMARY KEY  (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 ( 
+a varchar(12) charset utf8 collate utf8_bin not null, 
+b int not null, primary key (a)
+) select a, 1 as c from t2 ;
 Warnings:
-Warning	1364	Field 'a' doesn't have a default value
 Warning	1364	Field 'b' doesn't have a default value
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
   `b` int(11) NOT NULL,
+  `a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
+  `c` bigint(1) NOT NULL default '0',
+  PRIMARY KEY  (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 ( 
+a varchar(12) charset utf8 collate utf8_bin not null, 
+b int null, primary key (a)
+) select a, 1 as c from t2 ;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `b` int(11) default NULL,
+  `a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
+  `c` bigint(1) NOT NULL default '0',
   PRIMARY KEY  (`a`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
@@ -667,9 +689,6 @@
 a varchar(12) charset utf8 collate utf8_bin not null,
 b int not null, primary key (a)
 ) select 'a' as a , 1 as b from t2 ;
-Warnings:
-Warning	1364	Field 'a' doesn't have a default value
-Warning	1364	Field 'b' doesn't have a default value
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
@@ -682,8 +701,6 @@
 a varchar(12) charset utf8 collate utf8_bin,
 b int not null, primary key (a)
 ) select 'a' as a , 1 as b from t2 ;
-Warnings:
-Warning	1364	Field 'b' doesn't have a default value
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
@@ -702,8 +719,6 @@
 a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
 primary key (a1)
 ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
-Warnings:
-Warning	1364	Field 'a1' doesn't have a default value
 drop table t2;
 create table t2 ( 
 a1 varchar(12) charset utf8 collate utf8_bin,
@@ -719,8 +734,6 @@
 a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
 primary key (a1)
 ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
-Warnings:
-Warning	1364	Field 'a1' doesn't have a default value
 drop table t2;
 create table t2 ( a int default 3, b int default 3)
 select a1,a2 from t1;

--- 1.73/mysql-test/t/create.test	2005-12-30 20:49:49 -08:00
+++ 1.74/mysql-test/t/create.test	2006-01-06 10:34:55 -08:00
@@ -567,6 +567,22 @@
 
 --warning 1364
 create table t1 ( 
+  a varchar(12) charset utf8 collate utf8_bin not null, 
+  b int not null, primary key (a)
+) select a, 1 as c from t2 ;
+show create table t1;
+drop table t1;
+
+--warning 1364
+create table t1 ( 
+  a varchar(12) charset utf8 collate utf8_bin not null, 
+  b int null, primary key (a)
+) select a, 1 as c from t2 ;
+show create table t1;
+drop table t1;
+
+--warning 1364
+create table t1 ( 
   a varchar(12) charset utf8 collate utf8_bin not null,
   b int not null, primary key (a)
 ) select 'a' as a , 1 as b from t2 ;

--- 1.46/sql/ha_federated.cc	2005-12-21 10:24:56 -08:00
+++ 1.47/sql/ha_federated.cc	2006-01-06 10:34:55 -08:00
@@ -2607,8 +2607,7 @@
 {
   DBUG_ENTER("ha_federated::stash_remote_error()");
   remote_error_number= mysql_errno(mysql);
-  my_snprintf(remote_error_buf, sizeof(remote_error_buf), "%s",
-              mysql_error(mysql));
+  strmake(remote_error_buf, mysql_error(mysql), sizeof(remote_error_buf)-1);
   DBUG_RETURN(HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM);
 }
 

--- 1.101/sql/sp.cc	2005-12-21 20:10:56 -08:00
+++ 1.102/sql/sp.cc	2006-01-06 10:34:56 -08:00
@@ -398,14 +398,14 @@
                 const char *body, st_sp_chistics &chistics,
                 const char *definer, longlong created, longlong modified)
 {
-  LEX *oldlex= thd->lex, newlex;
-  sp_rcontext *save_spcont= thd->spcont;
+  LEX *old_lex= thd->lex, newlex;
   String defstr;
   char olddb[128];
   bool dbchanged;
   ulong old_sql_mode= thd->variables.sql_mode;
-  ha_rows select_limit= thd->variables.select_limit;
-  int ret= SP_INTERNAL_ERROR;
+  ha_rows old_select_limit= thd->variables.select_limit;
+  sp_rcontext *old_spcont= thd->spcont;
+  int ret;
 
   thd->variables.sql_mode= sql_mode;
   thd->variables.select_limit= HA_POS_ERROR;
@@ -421,7 +421,10 @@
 		     returns, strlen(returns),
 		     body, strlen(body),
 		     &chistics))
+  {
+    ret= SP_INTERNAL_ERROR;
     goto end;
+  }
 
   dbchanged= FALSE;
   if ((ret= sp_use_new_db(thd, name->m_db.str, olddb, sizeof(olddb),
@@ -450,10 +453,10 @@
     (*sphp)->optimize();
   }
 end:
-  thd->spcont= save_spcont;
+  thd->spcont= old_spcont;
   thd->variables.sql_mode= old_sql_mode;
-  thd->variables.select_limit= select_limit;
-  thd->lex= oldlex;
+  thd->variables.select_limit= old_select_limit;
+  thd->lex= old_lex;
   return ret;
 }
 
@@ -927,7 +930,6 @@
   ulong depth= (type == TYPE_ENUM_PROCEDURE ?
                 thd->variables.max_sp_recursion_depth :
                 0);
-
   DBUG_ENTER("sp_find_routine");
   DBUG_PRINT("enter", ("name:  %.*s.%.*s, type: %d, cache only %d",
                        name->m_db.length, name->m_db.str,
@@ -937,6 +939,11 @@
   if ((sp= sp_cache_lookup(cp, name)))
   {
     ulong level;
+    sp_head *new_sp;
+    const char *returns= "";
+    char definer[HOSTNAME_LENGTH+USERNAME_LENGTH+2];
+    String retstr(64);
+
     DBUG_PRINT("info", ("found: 0x%lx", (ulong)sp));
     if (sp->m_first_free_instance)
     {
@@ -947,7 +954,7 @@
       DBUG_ASSERT(!(sp->m_first_free_instance->m_flags & sp_head::IS_INVOKED));
       if (sp->m_first_free_instance->m_recursion_level > depth)
       {
-        sp->recursion_level_error();
+        sp->recursion_level_error(thd);
         DBUG_RETURN(0);
       }
       DBUG_RETURN(sp->m_first_free_instance);
@@ -955,37 +962,32 @@
     level= sp->m_last_cached_sp->m_recursion_level + 1;
     if (level > depth)
     {
-      sp->recursion_level_error();
+      sp->recursion_level_error(thd);
       DBUG_RETURN(0);
     }
+
+    strxmov(definer, sp->m_definer_user.str, "@",
+            sp->m_definer_host.str, NullS);
+    if (type == TYPE_ENUM_FUNCTION)
     {
-      sp_head *new_sp;
-      const char *returns= "";
-      char definer[HOSTNAME_LENGTH+USERNAME_LENGTH+2];
-      String retstr(64);
-      strxmov(definer, sp->m_definer_user.str, "@",
-                       sp->m_definer_host.str, NullS);
-      if (type == TYPE_ENUM_FUNCTION)
-      {
-        sp_returns_type(thd, retstr, sp);
-        returns= retstr.ptr();
-      }
-      if (db_load_routine(thd, type, name, &new_sp,
-                          sp->m_sql_mode, sp->m_params.str, returns,
-                          sp->m_body.str, *sp->m_chistics, definer,
-                          sp->m_created, sp->m_modified) == SP_OK)
-      {
-        sp->m_last_cached_sp->m_next_cached_sp= new_sp;
-        new_sp->m_recursion_level= level;
-        new_sp->m_first_instance= sp;
-        sp->m_last_cached_sp= sp->m_first_free_instance= new_sp;
-        DBUG_PRINT("info", ("added level: 0x%lx, level: %lu, flags %x",
+      sp_returns_type(thd, retstr, sp);
+      returns= retstr.ptr();
+    }
+    if (db_load_routine(thd, type, name, &new_sp,
+                        sp->m_sql_mode, sp->m_params.str, returns,
+                        sp->m_body.str, *sp->m_chistics, definer,
+                        sp->m_created, sp->m_modified) == SP_OK)
+    {
+      sp->m_last_cached_sp->m_next_cached_sp= new_sp;
+      new_sp->m_recursion_level= level;
+      new_sp->m_first_instance= sp;
+      sp->m_last_cached_sp= sp->m_first_free_instance= new_sp;
+      DBUG_PRINT("info", ("added level: 0x%lx, level: %lu, flags %x",
                           (ulong)new_sp, new_sp->m_recursion_level,
                           new_sp->m_flags));
-        DBUG_RETURN(new_sp);
-      }
-      DBUG_RETURN(0);
+      DBUG_RETURN(new_sp);
     }
+    DBUG_RETURN(0);
   }
   if (!cache_only)
   {

--- 1.208/sql/sp_head.cc	2005-12-21 20:10:55 -08:00
+++ 1.209/sql/sp_head.cc	2006-01-06 10:34:56 -08:00
@@ -24,6 +24,13 @@
 #include "sp_rcontext.h"
 #include "sp_cache.h"
 
+/*
+  Sufficient max length of printed destinations and frame offsets (all uints).
+*/
+#define SP_INSTR_UINT_MAXLEN  8
+#define SP_STMT_PRINT_MAXLEN 40
+
+
 Item_result
 sp_map_result_type(enum enum_field_types type)
 {
@@ -876,17 +883,17 @@
 
   SYNOPSIS
     sp_head::recursion_level_error()
+    thd		Thread handle
 
   NOTE
     For functions and triggers we return error about prohibited recursion.
     For stored procedures we return about reaching recursion limit.
 */
 
-void sp_head::recursion_level_error()
+void sp_head::recursion_level_error(THD *thd)
 {
   if (m_type == TYPE_ENUM_PROCEDURE)
   {
-    THD *thd= current_thd;
     my_error(ER_SP_RECURSION_LIMIT, MYF(0),
              thd->variables.max_sp_recursion_depth,
              m_name.str);
@@ -937,14 +944,15 @@
   DBUG_ASSERT(!(m_flags & IS_INVOKED));
   m_flags|= IS_INVOKED;
   m_first_instance->m_first_free_instance= m_next_cached_sp;
-  DBUG_PRINT("info", ("first free for 0x%lx ++: 0x%lx->0x%lx, level: %lu, flags %x",
-                      (ulong)m_first_instance, this, m_next_cached_sp,
-                      (m_next_cached_sp ?
-                       m_next_cached_sp->m_recursion_level :
-                       0),
-                      (m_next_cached_sp ?
-                       m_next_cached_sp->m_flags :
-                       0)));
+  if (m_next_cached_sp)
+  {
+    DBUG_PRINT("info",
+               ("first free for 0x%lx ++: 0x%lx->0x%lx  level: %lu  flags %x",
+                (ulong)m_first_instance, (ulong) this,
+                (ulong) m_next_cached_sp,
+                m_next_cached_sp->m_recursion_level,
+                m_next_cached_sp->m_flags));
+  }
   /*
     Check that if there are not any instances after this one then
     pointer to the last instance points on this instance or if there are
@@ -1112,13 +1120,15 @@
   state= EXECUTED;
 
  done:
-  DBUG_PRINT("info", ("err_status=%d killed=%d query_error=%d",
+  DBUG_PRINT("info", ("err_status: %d  killed: %d  query_error: %d",
 		      err_status, thd->killed, thd->query_error));
 
   if (thd->killed)
     err_status= TRUE;
-  /* If the DB has changed, the pointer has changed too, but the
-     original thd->db will then have been freed */
+  /*
+    If the DB has changed, the pointer has changed too, but the
+    original thd->db will then have been freed
+  */
   if (dbchanged)
   {
     /*
@@ -1129,10 +1139,11 @@
       err_status|= mysql_change_db(thd, olddb, 1);
   }
   m_flags&= ~IS_INVOKED;
-  DBUG_PRINT("info", ("first free for 0x%lx --: 0x%lx->0x%lx, level: %lu, flags %x",
-                      (ulong)m_first_instance,
-                      m_first_instance->m_first_free_instance, this,
-                      m_recursion_level, m_flags));
+  DBUG_PRINT("info",
+             ("first free for 0x%lx --: 0x%lx->0x%lx, level: %lu, flags %x",
+              (ulong) m_first_instance,
+              (ulong) m_first_instance->m_first_free_instance,
+              (ulong) this, m_recursion_level, m_flags));
   /*
     Check that we have one of following:
 
@@ -1142,7 +1153,7 @@
 
     2) There are some free instances which mean that first free instance
     should go just after this one and recursion level of that free instance
-    should be on 1 more then recursion leven of this instance.
+    should be on 1 more then recursion level of this instance.
   */
   DBUG_ASSERT((m_first_instance->m_first_free_instance == 0 &&
                this == m_first_instance->m_last_cached_sp &&
@@ -1756,16 +1767,16 @@
 
 
 void
-sp_head::set_definer(char *definer, uint definerlen)
+
+sp_head::set_definer(const char *definer, uint definerlen)
 {
-  char *p= strrchr(definer, '@');
+  const char *p= strrchr(definer, '@');
 
   if (!p)
   {
-    m_definer_user.str= strmake_root(mem_root, "", 0);
+    m_definer_user.str= (char*) "";
     m_definer_user.length= 0;
-    
-    m_definer_host.str= strmake_root(mem_root, "", 0);
+    m_definer_host.str= (char*) "";
     m_definer_host.length= 0;
   }
   else
@@ -1860,9 +1871,9 @@
   byte *sql_mode_str;
   ulong sql_mode_len;
   bool full_access;
-
   DBUG_ENTER("sp_head::show_create_procedure");
   DBUG_PRINT("info", ("procedure %s", m_name.str));
+
   LINT_INIT(sql_mode_str);
   LINT_INIT(sql_mode_len);
 
@@ -2215,12 +2226,7 @@
   DBUG_RETURN(res);
 }
 
-/* 
-   Sufficient max length of printed destinations and frame offsets (all uints).
-*/
-#define SP_INSTR_UINT_MAXLEN  8
 
-#define SP_STMT_PRINT_MAXLEN 40
 void
 sp_instr_stmt::print(String *str)
 {
@@ -2242,16 +2248,16 @@
   /* Copy the query string and replace '\n' with ' ' in the process */
   for (i= 0 ; i < len ; i++)
   {
-    if (m_query.str[i] == '\n')
-      str->qs_append(' ');
-    else
-      str->qs_append(m_query.str[i]);
+    char c= m_query.str[i];
+    if (c == '\n')
+      c= ' ';
+    str->qs_append(c);
   }
   if (m_query.length > SP_STMT_PRINT_MAXLEN)
     str->qs_append(STRING_WITH_LEN("...")); /* Indicate truncated string */
   str->qs_append('"');
 }
-#undef SP_STMT_PRINT_MAXLEN
+
 
 int
 sp_instr_stmt::exec_core(THD *thd, uint *nextp)
@@ -2617,6 +2623,7 @@
   DBUG_RETURN(0);
 }
 
+
 void
 sp_instr_hpush_jump::print(String *str)
 {
@@ -2627,8 +2634,7 @@
   str->qs_append(m_dest);
   str->qs_append(' ');
   str->qs_append(m_frame);
-  switch (m_type)
-  {
+  switch (m_type) {
   case SP_HANDLER_NONE:
     str->qs_append(STRING_WITH_LEN(" NONE")); // This would be a bug
     break;
@@ -2642,10 +2648,12 @@
     str->qs_append(STRING_WITH_LEN(" UNDO"));
     break;
   default:
-    str->qs_append(STRING_WITH_LEN(" UNKNOWN:")); // This would be a bug as well
+    // This would be a bug as well
+    str->qs_append(STRING_WITH_LEN(" UNKNOWN:"));
     str->qs_append(m_type);
   }
 }
+
 
 uint
 sp_instr_hpush_jump::opt_mark(sp_head *sp)

--- 1.80/sql/sp_head.h	2005-12-12 03:59:05 -08:00
+++ 1.81/sql/sp_head.h	2006-01-06 10:34:56 -08:00
@@ -285,7 +285,7 @@
   void set_info(longlong created, longlong modified,
 		st_sp_chistics *chistics, ulong sql_mode);
 
-  void set_definer(char *definer, uint definerlen);
+  void set_definer(const char *definer, uint definerlen);
 
   void reset_thd_mem_root(THD *thd);
 
@@ -294,7 +294,7 @@
   void optimize();
   void opt_mark(uint ip);
 
-  void recursion_level_error();
+  void recursion_level_error(THD *thd);
 
   inline sp_instr *
   get_instr(uint i)

--- 1.77/sql/sql_handler.cc	2005-11-23 12:44:57 -08:00
+++ 1.78/sql/sql_handler.cc	2006-01-06 10:34:57 -08:00
@@ -227,6 +227,7 @@
     /* add to hash */
     if (my_hash_insert(&thd->handler_tables_hash, (byte*) hash_tables))
     {
+      my_free((char*) hash_tables, MYF(0));
       mysql_ha_close(thd, tables);
       goto err;
     }
@@ -369,28 +370,6 @@
     DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p",
                                hash_tables->db, hash_tables->table_name,
                                hash_tables->alias, table));
-    /* Table might have been flushed. */
-    if (table && (table->s->version != refresh_version))
-    {
-      /*
-        We must follow the thd->handler_tables chain, as we need the
-        address of the 'next' pointer referencing this table
-        for close_thread_table().
-      */
-      for (table_ptr= &(thd->handler_tables);
-           *table_ptr && (*table_ptr != table);
-           table_ptr= &(*table_ptr)->next)
-      {}
-      (*table_ptr)->file->ha_index_or_rnd_end();
-      VOID(pthread_mutex_lock(&LOCK_open));
-      if (close_thread_table(thd, table_ptr))
-      {
-        /* Tell threads waiting for refresh that something has happened */
-        VOID(pthread_cond_broadcast(&COND_refresh));
-      }
-      VOID(pthread_mutex_unlock(&LOCK_open));
-      table= hash_tables->table= NULL;
-    }
     if (!table)
     {
       /*
@@ -436,6 +415,13 @@
   }
   tables->table=table;
 
+  HANDLER_TABLES_HACK(thd);
+  lock= mysql_lock_tables(thd, &tables->table, 1, 0, &not_used);
+  HANDLER_TABLES_HACK(thd);
+
+  if (!lock)
+    goto err0; // mysql_lock_tables() printed error message already
+
   if (cond && ((!cond->fixed &&
                 cond->fix_fields(thd, &cond)) || cond->check_cols(1)))
     goto err0;
@@ -454,13 +440,6 @@
     goto err0;
 
   protocol->send_fields(&list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
-
-  HANDLER_TABLES_HACK(thd);
-  lock= mysql_lock_tables(thd, &tables->table, 1, 0, &not_used);
-  HANDLER_TABLES_HACK(thd);
-
-  if (!lock)
-    goto err0; // mysql_lock_tables() printed error message already
 
   /*
     In ::external_lock InnoDB resets the fields which tell it that

--- 1.49/mysql-test/r/bdb.result	2005-12-21 10:24:56 -08:00
+++ 1.50/mysql-test/r/bdb.result	2006-01-06 10:34:55 -08:00
@@ -1957,4 +1957,9 @@
 e varchar(255) character set utf8,
 key (a,b,c,d,e)) engine=bdb;
 ERROR 42000: Specified key was too long; max key length is 3072 bytes
+set autocommit=0;
+create table t1 (a int) engine=bdb;
+commit;
+alter table t1 add primary key(a);
+drop table t1;
 End of 5.0 tests

--- 1.51/mysql-test/t/bdb.test	2005-12-21 10:24:56 -08:00
+++ 1.52/mysql-test/t/bdb.test	2006-01-06 10:34:55 -08:00
@@ -1036,4 +1036,13 @@
                  e varchar(255) character set utf8,
                  key (a,b,c,d,e)) engine=bdb;
 
+#
+# Bug #14212: Server crash after COMMIT + ALTER TABLE
+#
+set autocommit=0;
+create table t1 (a int) engine=bdb;
+commit;
+alter table t1 add primary key(a);
+drop table t1;
+
 --echo End of 5.0 tests
Thread
bk commit into 5.1 tree (jimw:1.2047)Jim Winstead6 Jan