List:Commits« Previous MessageNext Message »
From:igor Date:April 6 2006 10:31pm
Subject:bk commit into 5.1 tree (igor:1.2300)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 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
  1.2300 06/04/06 15:31:30 igor@stripped +2 -0
  Merge rurik.mysql.com:/home/igor/dev/mysql-5.0-0
  into  rurik.mysql.com:/home/igor/dev/mysql-5.1-0

  sql/opt_sum.cc
    1.49 06/04/06 15:31:22 igor@stripped +0 -0
    Auto merged

  sql/item.cc
    1.182 06/04/06 15:31:22 igor@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:	igor
# Host:	rurik.mysql.com
# Root:	/home/igor/dev/mysql-5.1-0/RESYNC

--- 1.181/sql/item.cc	2006-04-05 06:59:51 -07:00
+++ 1.182/sql/item.cc	2006-04-06 15:31:22 -07:00
@@ -3061,6 +3061,7 @@
   int         found_match_degree= 0;
   Item_ident *cur_field;
   int         cur_match_degree= 0;
+  char        name_buff[NAME_LEN+1];
 
   if (find_item->type() == Item::FIELD_ITEM ||
       find_item->type() == Item::REF_ITEM)
@@ -3071,6 +3072,14 @@
   }
   else
     return NULL;
+
+  if (db_name && lower_case_table_names)
+  {
+    /* Convert database to lower case for comparison */
+    strmake(name_buff, db_name, sizeof(name_buff)-1);
+    my_casedn_str(files_charset_info, name_buff);
+    db_name= name_buff;
+  }
 
   DBUG_ASSERT(field_name != 0);
 

--- 1.48/sql/opt_sum.cc	2006-04-05 14:00:46 -07:00
+++ 1.49/sql/opt_sum.cc	2006-04-06 15:31:22 -07:00
@@ -123,8 +123,11 @@
       If the storage manager of 'tl' gives exact row count, compute the total
       number of rows. If there are no outer table dependencies, this count
       may be used as the real count.
+      Schema tables are filled after this function is invoked, so we can't
+      get row count 
     */
-    if (tl->table->file->table_flags() & HA_NOT_EXACT_COUNT)
+    if ((tl->table->file->table_flags() & HA_NOT_EXACT_COUNT) ||
+        tl->schema_table)
     {
       is_exact_count= FALSE;
       count= 1;                                 // ensure count != 0
@@ -149,31 +152,15 @@
       switch (item_sum->sum_func()) {
       case Item_sum::COUNT_FUNC:
         /*
-          If the expr in count(expr) can never be null we can change this
+          If the expr in COUNT(expr) can never be null we can change this
           to the number of rows in the tables if this number is exact and
           there are no outer joins.
         */
         if (!conds && !((Item_sum_count*) item)->args[0]->maybe_null &&
             !outer_tables && is_exact_count)
         {
-          longlong count= 1;
-          TABLE_LIST *table;
-          for (table= tables; table; table= table->next_leaf)
-          {
-            if (outer_tables || (table->table->file->table_flags() &
-                                 HA_NOT_EXACT_COUNT) || table->schema_table)
-            {
-              const_result= 0;			// Can't optimize left join
-              break;
-            }
-            tables->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
-            count*= table->table->file->records;
-          }
-          if (!table)
-          {
-            ((Item_sum_count*) item)->make_const(count);
-            recalc_const_item= 1;
-          }
+          ((Item_sum_count*) item)->make_const(count);
+          recalc_const_item= 1;
         }
         else
           const_result= 0;
Thread
bk commit into 5.1 tree (igor:1.2300)igor7 Apr