List:Commits« Previous MessageNext Message »
From:jhe Date:September 1 2006 10:31am
Subject:bk commit into 5.0 tree (Justin.He:1.2255)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of justin.he. When justin.he 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, 2006-09-01 18:31:17+08:00, Justin.He@stripped +2 -0
  Merge jhe@stripped:/home/bk/mysql-5.0-ndb
  into  qa3-104.qa.cn.tlan:/mnt/sda7/justin.he/mysql/mysql-5.0-ndb-bj
  MERGE: 1.2248.1.3

  sql/sql_base.cc@stripped, 2006-09-01 18:31:06+08:00, Justin.He@stripped +0 -0
    Auto merged
    MERGE: 1.347.1.3

  sql/sql_view.cc@stripped, 2006-09-01 18:31:06+08:00, Justin.He@stripped +0 -0
    Auto merged
    MERGE: 1.92.1.1

# 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:	Justin.He
# Host:	qa3-104.qa.cn.tlan
# Root:	/mnt/sda7/justin.he/mysql/mysql-5.0-ndb-bj/RESYNC

--- 1.350/sql/sql_base.cc	2006-09-01 18:31:31 +08:00
+++ 1.351/sql/sql_base.cc	2006-09-01 18:31:31 +08:00
@@ -4563,9 +4563,11 @@
                                    TABLE_LIST *tables,
                                    Item **conds, TABLE_LIST **leaves,
                                    bool select_insert,
+                                   ulong want_access_first,
                                    ulong want_access)
 {
   TABLE_LIST *leaves_tmp = NULL;
+  bool first_table= true;
 
   if (setup_tables (thd, context, from_clause, tables, conds, 
                     &leaves_tmp, select_insert))
@@ -4575,13 +4577,16 @@
     *leaves = leaves_tmp;
 
   for (; leaves_tmp; leaves_tmp= leaves_tmp->next_leaf)
+  {
     if (leaves_tmp->belong_to_view && 
-        check_single_table_access(thd, want_access,  leaves_tmp))
+        check_single_table_access(thd, first_table ? want_access_first :
+                                  want_access,  leaves_tmp))
     {
       tables->hide_view_error(thd);
       return TRUE;
     }
-
+    first_table= false;
+  }
   return FALSE;
 }
 

--- 1.93/sql/sql_view.cc	2006-09-01 18:31:31 +08:00
+++ 1.94/sql/sql_view.cc	2006-09-01 18:31:31 +08:00
@@ -1060,6 +1060,31 @@
       table->next_global= view_tables;
     }
 
+    bool view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE &&
+                             lex->can_be_merged());
+    TABLE_LIST *view_main_select_tables;
+    if (view_is_mergeable)
+    {
+      /*
+        Currently 'view_main_select_tables' differs from 'view_tables'
+        only then view has CONVERT_TZ() function in its select list.
+        This may change in future, for example if we enable merging of
+        views with subqueries in select list.
+      */
+      view_main_select_tables=
+        (TABLE_LIST*)lex->select_lex.table_list.first;
+
+      /*
+        Let us set proper lock type for tables of the view's main
+        select since we may want to perform update or insert on
+        view. This won't work for view containing union. But this is
+        ok since we don't allow insert and update on such views
+        anyway.
+      */
+      for (tbl= view_main_select_tables; tbl; tbl= tbl->next_local)
+        tbl->lock_type= table->lock_type;
+    }
+
     /*
       If we are opening this view as part of implicit LOCK TABLES, then
       this view serves as simple placeholder and we should not continue
@@ -1114,43 +1139,26 @@
       - VIEW SELECT allow merging
       - VIEW used in subquery or command support MERGE algorithm
     */
-    if (table->algorithm != VIEW_ALGORITHM_TMPTABLE &&
-	lex->can_be_merged() &&
+    if (view_is_mergeable &&
         (table->select_lex->master_unit() != &old_lex->unit ||
          old_lex->can_use_merged()) &&
         !old_lex->can_not_use_merged())
     {
-      List_iterator_fast<TABLE_LIST> ti(view_select->top_join_list);
-      /*
-        Currently 'view_main_select_tables' differs from 'view_tables'
-        only then view has CONVERT_TZ() function in its select list.
-        This may change in future, for example if we enable merging
-        of views with subqueries in select list.
-      */
-      TABLE_LIST *view_main_select_tables=
-                    (TABLE_LIST*)lex->select_lex.table_list.first;
       /* lex should contain at least one table */
       DBUG_ASSERT(view_main_select_tables != 0);
 
+      List_iterator_fast<TABLE_LIST> ti(view_select->top_join_list);
+
       table->effective_algorithm= VIEW_ALGORITHM_MERGE;
       DBUG_PRINT("info", ("algorithm: MERGE"));
       table->updatable= (table->updatable_view != 0);
       table->effective_with_check=
         old_lex->get_effective_with_check(table);
       table->merge_underlying_list= view_main_select_tables;
-      /*
-        Let us set proper lock type for tables of the view's main select
-        since we may want to perform update or insert on view. This won't
-        work for view containing union. But this is ok since we don't
-        allow insert and update on such views anyway.
 
-        Also we fill correct wanted privileges.
-      */
-      for (tbl= table->merge_underlying_list; tbl; tbl= tbl->next_local)
-      {
-        tbl->lock_type= table->lock_type;
+      /* Fill correct wanted privileges. */
+      for (tbl= view_main_select_tables; tbl; tbl= tbl->next_local)
         tbl->grant.want_privilege= top_view->grant.orig_want_privilege;
-      }
 
       /* prepare view context */
       lex->select_lex.context.resolve_in_table_list_only(view_main_select_tables);
Thread
bk commit into 5.0 tree (Justin.He:1.2255)jhe1 Sep