MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:April 5 2006 9:29am
Subject:bk commit into 5.0 tree (evgen:1.2092) BUG#16281
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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.2092 06/04/05 13:29:04 evgen@stripped +2 -0
  Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
  
  Mutli-table uses temporary table to store new values for fields. With the
  new values the rowid of the record to be updated is stored in a Field_string
  field. Table to be updated is set as source table of the rowid field.
  But when the temporary table creates the tmp field for the rowid field it
  converts it to a varstring field because the table to be updated was created by
  the v4.1. Due to this the stored rowids were broken and no records for 
  update were found.
  
  The flag can_alter_field_type is added to Field_string class. When it is set to
  0 the field won't be converted to varstring. The Field_string::type() function 
  now always returns MYSQL_TYPE_STRING if can_alter_field_type is set to 0.
  The multi_update::initialize_tables() function now sets can_alter_field_type
  flag to 0 for the rowid fields denying conversion of the field to a varstring
  field.
  

  sql/sql_update.cc
    1.187 06/04/05 13:27:49 evgen@stripped +5 -0
    Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
    The multi_update::initialize_tables() function now sets can_alter_field_type
    flag to 0 for the rowid fields denying conversion of the field to a varstring
    field.

  sql/field.h
    1.174 06/04/05 13:21:37 evgen@stripped +6 -3
    Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
    The flag can_alter_field_type is added to Field_string class. When it is set to
    0 the field won't be converted to varstring.
    The Field_string::type() function now always returns MYSQL_TYPE_STRING if 
    can_alter_field_type is set to 0.

# 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:	evgen
# Host:	sunlight.local
# Root:	/local_work/16281-bug-5.0-mysql

--- 1.173/sql/field.h	2006-02-27 21:26:21 +03:00
+++ 1.174/sql/field.h	2006-04-05 13:21:37 +04:00
@@ -980,20 +980,23 @@ public:
 
 class Field_string :public Field_longstr {
 public:
+  bool can_alter_field_type;
   Field_string(char *ptr_arg, uint32 len_arg,uchar *null_ptr_arg,
 	       uchar null_bit_arg,
 	       enum utype unireg_check_arg, const char *field_name_arg,
 	       struct st_table *table_arg, CHARSET_INFO *cs)
     :Field_longstr(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
-                   unireg_check_arg, field_name_arg, table_arg, cs) {};
+                   unireg_check_arg, field_name_arg, table_arg, cs),
+     can_alter_field_type(1) {};
   Field_string(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
                struct st_table *table_arg, CHARSET_INFO *cs)
     :Field_longstr((char*) 0, len_arg, maybe_null_arg ? (uchar*) "": 0, 0,
-                   NONE, field_name_arg, table_arg, cs) {};
+                   NONE, field_name_arg, table_arg, cs),
+     can_alter_field_type(1) {};
 
   enum_field_types type() const
   {
-    return ((orig_table &&
+    return ((can_alter_field_type && orig_table &&
              orig_table->s->db_create_options & HA_OPTION_PACK_RECORD &&
 	     field_length >= 4) &&
             orig_table->s->frm_version < FRM_VER_TRUE_VARCHAR ?

--- 1.186/sql/sql_update.cc	2006-02-25 18:46:27 +03:00
+++ 1.187/sql/sql_update.cc	2006-04-05 13:27:49 +04:00
@@ -1093,6 +1093,11 @@ multi_update::initialize_tables(JOIN *jo
     /* ok to be on stack as this is not referenced outside of this func */
     Field_string offset(table->file->ref_length, 0, "offset",
 			table, &my_charset_bin);
+    /*
+      The field will be converted to varstring when creating tmp table if
+      table to be updated was created by mysql 4.1. Deny this.
+    */
+    offset.can_alter_field_type= 0;
     if (!(ifield= new Item_field(((Field *) &offset))))
       DBUG_RETURN(1);
     ifield->maybe_null= 0;
Thread
bk commit into 5.0 tree (evgen:1.2092) BUG#16281eugene5 Apr