MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:igor Date:March 26 2007 6:44am
Subject:bk commit into 5.0 tree (igor:1.2417) BUG#27229
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of igor. When igor 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-03-25 23:44:06-07:00, igor@stripped +2 -0
  This is a fix for the memory corruption occurred in one of test cases
  from func_group.test after the patch for bug #27229 had been applied.
  The memory corruption happened because in some rare cases the function
  count_field_types underestimated the number of elements in
  in the array param->items_to_copy.

  sql/item_sum.cc@stripped, 2007-03-25 23:44:03-07:00, igor@stripped +1 -2
    The return value of the Item_sum::update_used_tables method
    should not depend on the place of aggregation of the set 
    function for which the Item_sum object has been created.

  sql/sql_select.cc@stripped, 2007-03-25 23:44:03-07:00, igor@stripped +16 -10
    This is a fix for the memory corruption occurred in one of test cases
    from func_group.test after the patch for bug #27229 had been applied.
    The memory corruption happened because in some rare cases the function
    count_field_types underestimated the number of elements in
    in the array param->items_to_copy.
    
    Currently it's not guaranteed that after JOIN::prepare() the 
    used_tables attribute is calculated for all items. For example
    for the expression SUM(outer_ref)+1 used_tables() must return
    OUTER_REF_TABLE_BIT. Yet by the moment when the used_tables
    attribute is calculated in JOIN::prepare SUM(outer_ref) has
    not been substituted for Item_aggregate_ref yet.
    By this reason additional calls of the method update_used_tables
    are needed for some items passed as parameters to the function
    create_tmp_table. 
     

# 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:	igor
# Host:	olga.mysql.com
# Root:	/home/igor/dev-opt/mysql-5.0-opt-bug27229

--- 1.200/sql/item_sum.cc	2007-03-25 23:44:12 -07:00
+++ 1.201/sql/item_sum.cc	2007-03-25 23:44:12 -07:00
@@ -449,8 +449,7 @@
     used_tables_cache&= PSEUDO_TABLE_BITS;
 
     /* the aggregate function is aggregated into its local context */
-    if (aggr_level == nest_level)
-      used_tables_cache |=  (1 << aggr_sel->join->tables) - 1;
+    used_tables_cache |=  (1 << aggr_sel->join->tables) - 1;
   }
 }
 

--- 1.501/sql/sql_select.cc	2007-03-25 23:44:12 -07:00
+++ 1.502/sql/sql_select.cc	2007-03-25 23:44:12 -07:00
@@ -9196,17 +9196,21 @@
     Item::Type type=item->type();
     if (not_all_columns)
     {
-      if (item->with_sum_func && type != Item::SUM_FUNC_ITEM &&
-          (type == Item::SUBSELECT_ITEM ||
-           (item->used_tables() & ~PSEUDO_TABLE_BITS)))
+      if (item->with_sum_func && type != Item::SUM_FUNC_ITEM)
       {
-	/*
-	  Mark that the we have ignored an item that refers to a summary
-	  function. We need to know this if someone is going to use
-	  DISTINCT on the result.
-	*/
-	param->using_indirect_summary_function=1;
-	continue;
+        if (item->used_tables() & OUTER_REF_TABLE_BIT)
+          item->update_used_tables();
+        if (type == Item::SUBSELECT_ITEM ||
+            (item->used_tables() & ~OUTER_REF_TABLE_BIT))
+        {
+	  /*
+	    Mark that the we have ignored an item that refers to a summary
+	    function. We need to know this if someone is going to use
+	    DISTINCT on the result.
+	  */
+	  param->using_indirect_summary_function=1;
+	  continue;
+        }
       }
       if (item->const_item() && (int) hidden_field_count <= 0)
         continue; // We don't have to store this
@@ -9391,6 +9395,7 @@
     table->s->default_values= table->record[1]+alloc_length;
   }
   copy_func[0]=0;				// End marker
+  param->func_count= copy_func - param->items_to_copy; 
 
   recinfo=param->start_recinfo;
   null_flags=(uchar*) table->record[0];
@@ -13571,6 +13576,7 @@
 	if (!sum_item->quick_group)
 	  param->quick_group=0;			// UDF SUM function
 	param->sum_func_count++;
+        param->func_count++;
 
 	for (uint i=0 ; i < sum_item->arg_count ; i++)
 	{
Thread
bk commit into 5.0 tree (igor:1.2417) BUG#27229igor26 Mar