MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:July 28 2007 12:02pm
Subject:bk commit into 5.0 tree (evgen:1.2483) BUG#30020
View as plain text  
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@stripped, 2007-07-28 16:02:29+04:00, evgen@stripped +3 -0
  Bug#30020: Insufficient check led to a wrong info provided by the
  information schema table.
  
  The get_schema_views_record() function fills records in the view table of
  the informations schema with data about given views. Among other info
  the is_updatable flag is set. But the check whether the view is updatable or
  not wasn't covering all cases thus sometimes providing wrong info.
  This might led to a user confusion.
  
  Now the get_schema_views_record function additionally calls to the 
  view->can_be_merge() function to find out whether the view can be updated or
  not.

  mysql-test/r/view.result@stripped, 2007-07-28 16:01:23+04:00, evgen@stripped +15 -0
    Added a test case for the bug#30020: Insufficient check led to a wrong info
    provided by the information schema table.

  mysql-test/t/view.test@stripped, 2007-07-28 16:00:31+04:00, evgen@stripped +13 -0
    Added a test case for the bug#30020: Insufficient check led to a wrong info
    provided by the information schema table.

  sql/sql_show.cc@stripped, 2007-07-28 16:01:43+04:00, evgen@stripped +3 -1
    Bug#30020: Insufficient check led to a wrong info provided by the
    information schema table.
    Now the get_schema_views_record function additionally calls to the 
    view->can_be_merge() function to find out whether the view can be updated or
    not.

diff -Nrup a/mysql-test/r/view.result b/mysql-test/r/view.result
--- a/mysql-test/r/view.result	2007-07-05 08:11:57 +04:00
+++ b/mysql-test/r/view.result	2007-07-28 16:01:23 +04:00
@@ -3547,4 +3547,19 @@ a	b
 6	6
 DROP VIEW v1;
 DROP TABLE t1,t2,t3;
+create table t1 (i int);
+insert into t1 values (1), (2), (1), (3), (2), (4);
+create view v1 as select distinct i from t1;
+select * from v1;
+i
+1
+2
+3
+4
+select table_name, is_updatable from information_schema.views 
+where table_name = 'v1';
+table_name	is_updatable
+v1	NO
+drop view v1;
+drop table t1;
 End of 5.0 tests.
diff -Nrup a/mysql-test/t/view.test b/mysql-test/t/view.test
--- a/mysql-test/t/view.test	2007-07-05 08:11:57 +04:00
+++ b/mysql-test/t/view.test	2007-07-28 16:00:31 +04:00
@@ -3402,5 +3402,18 @@ SELECT t.person_id AS a, t.person_id AS 
 DROP VIEW v1;
 DROP TABLE t1,t2,t3;
 
+#
+# Bug#30020: Insufficient check led to a wrong info provided by the
+#            information schema table.
+#
+create table t1 (i int);
+insert into t1 values (1), (2), (1), (3), (2), (4);
+create view v1 as select distinct i from t1;
+select * from v1;
+select table_name, is_updatable from information_schema.views 
+   where table_name = 'v1';
+drop view v1;
+drop table t1;
+
 --echo End of 5.0 tests.
 
diff -Nrup a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc	2007-07-16 23:40:31 +04:00
+++ b/sql/sql_show.cc	2007-07-28 16:01:43 +04:00
@@ -3211,7 +3211,7 @@ static int get_schema_views_record(THD *
       Item *item;
       Item_field *field;
       /*
-        chech that at least one coulmn in view is updatable
+        check that at least one column in view is updatable
       */
       while ((item= it++))
       {
@@ -3222,6 +3222,8 @@ static int get_schema_views_record(THD *
           break;
         }
       }
+      if (updatable_view && !tables->view->can_be_merged())
+        updatable_view= 0;
     }
     if (updatable_view)
       table->field[5]->store(STRING_WITH_LEN("YES"), cs);
Thread
bk commit into 5.0 tree (evgen:1.2483) BUG#30020eugene28 Jul