From: Date: April 3 2006 12:29pm Subject: bk commit into 5.0 tree (evgen:1.2092) BUG#16281 List-Archive: http://lists.mysql.com/commits/4408 X-Bug: 16281 Message-Id: <20060403102906.76DF511C008@sunlight.local> 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/03 14:29:00 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 is_string is added to Field_string class. It is set for fields known to be a string, not a varstring. The Field_string::type() function now always returns MYSQL_TYPE_STRING if is_string is set. The multi_update::initialize_tables() function now sets is_string flag for the rowid fields denying conversion of the field to a varstring field. sql/field.h 1.174 06/04/03 14:27:39 evgen@stripped +6 -3 Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1 The flag is_string is added to Field_string class. It is set for fields known to be a string, not a varstring. The Field_string::type() function now always returns MYSQL_TYPE_STRING if is_string is set. sql/sql_update.cc 1.187 06/04/03 14:25:04 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 is_string flag for the rowid fields denying conversion of the field to a varstring field. # 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-03 14:27:39 +04:00 @@ -980,20 +980,23 @@ public: class Field_string :public Field_longstr { public: + bool is_string; 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), + is_string(0) {}; 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), + is_string(0) {}; enum_field_types type() const { - return ((orig_table && + return ((!is_string && 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-03 14:25:04 +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.is_string= 1; if (!(ifield= new Item_field(((Field *) &offset)))) DBUG_RETURN(1); ifield->maybe_null= 0;