From: Date: March 30 2005 11:44am Subject: bk commit into 4.1 tree (ramil:1.2161) BUG#9401 List-Archive: http://lists.mysql.com/internals/23465 X-Bug: 9401 Message-Id: <200503300944.j2U9i1FP012483@gw.mysql.r18.ru> Below is the list of changes that have just been committed into a local 4.1 repository of ram. When ram 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.2161 05/03/30 14:43:56 ramil@stripped +1 -0 A fix (bug #9401: type_timestamp segfaults mysqld) sql/sql_select.cc 1.390 05/03/30 14:43:51 ramil@stripped +17 -15 A fix (bug #9401: type_timestamp segfaults mysqld). 1. create_tmp_field_from_field() is modified to take 'Item_ref *item' and 'char *name' instead of 'bool modify_item' and 'Item *item'. 2. For Item_sum_min/max we should never modify item, so NULL is passed as item to the create_tmp_field_from_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: ramil # Host: gw.mysql.r18.ru # Root: /usr/home/ram/work/mysql-4.1 --- 1.389/sql/sql_select.cc 2005-03-22 04:36:14 +04:00 +++ 1.390/sql/sql_select.cc 2005-03-30 14:43:51 +05:00 @@ -4604,14 +4604,14 @@ create_tmp_field_from_field() thd Thread handler org_field field from which new field will be created + name New field name item Item to create a field for table Temporary table - modify_item 1 if item->result_field should point to new item. - This is relevent for how fill_record() is going to - work: - If modify_item is 1 then fill_record() will update + item !=NULL if item->result_field should point to new field. + This is relevant for how fill_record() is going to work: + If item != NULL then fill_record() will update the record in the original table. - If modify_item is 0 then fill_record() will update + If item == NULL then fill_record() will update the temporary table convert_blob_length If >0 create a varstring(convert_blob_length) field instead of blob. @@ -4622,8 +4622,8 @@ */ static Field* create_tmp_field_from_field(THD *thd, Field* org_field, - Item *item, TABLE *table, - bool modify_item, + const char *name, TABLE *table, + Item_field *item, uint convert_blob_length) { Field *new_field; @@ -4636,10 +4636,10 @@ new_field= org_field->new_field(thd->mem_root, table); if (new_field) { - if (modify_item) - ((Item_field *)item)->result_field= new_field; + if (item) + item->result_field= new_field; else - new_field->field_name= item->name; + new_field->field_name= name; if (org_field->maybe_null()) new_field->flags&= ~NOT_NULL_FLAG; // Because of outer join if (org_field->type() == FIELD_TYPE_VAR_STRING) @@ -4779,8 +4779,8 @@ if (item_sum->args[0]->type() == Item::FIELD_ITEM) { *from_field= ((Item_field*) item_sum->args[0])->field; - return create_tmp_field_from_field(thd, *from_field, item, table, - modify_item, convert_blob_length); + return create_tmp_field_from_field(thd, *from_field, item->name, table, + NULL, convert_blob_length); } /* fall through */ default: @@ -4818,8 +4818,10 @@ case Item::DEFAULT_VALUE_ITEM: { Item_field *field= (Item_field*) item; - return create_tmp_field_from_field(thd, (*from_field= field->field), item, - table, modify_item, convert_blob_length); + return create_tmp_field_from_field(thd, (*from_field= field->field), + item->name, table, + modify_item ? (Item_field*) item : NULL, + convert_blob_length); } case Item::FUNC_ITEM: case Item::COND_ITEM: @@ -4840,7 +4842,7 @@ { Field *example= ((Item_type_holder *)item)->example(); if (example) - return create_tmp_field_from_field(thd, example, item, table, 0, + return create_tmp_field_from_field(thd, example, item->name, table, NULL, convert_blob_length); return create_tmp_field_from_item(thd, item, table, copy_func, 0, convert_blob_length);