List:Internals« Previous MessageNext Message »
From:ingo Date:May 5 2005 3:46pm
Subject:bk commit into 5.0 tree (ingo:1.1912) BUG#9842
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of mydev. When mydev 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.1912 05/05/05 15:46:50 ingo@stripped +3 -0
  Bug#9842 - Views:Any operation on a view created with merge option crashes mysql
service.
  Added a check for a null table element to prevent the crash.

  sql/table.cc
    1.161 05/05/05 15:46:46 ingo@stripped +2 -1
    Bug#9842 - Views:Any operation on a view created with merge option crashes mysql
service.
    Added a check for a null table element to prevent the crash.

  mysql-test/t/view.test
    1.68 05/05/05 15:46:45 ingo@stripped +32 -0
    Bug#9842 - Views:Any operation on a view created with merge option crashes mysql
service.
    The test case.

  mysql-test/r/view.result
    1.79 05/05/05 15:46:45 ingo@stripped +71 -0
    Bug#9842 - Views:Any operation on a view created with merge option crashes mysql
service.
    The test result.

# 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:	ingo
# Host:	synthia.local
# Root:	/home/mydev/mysql-5.0-bug9842

--- 1.160/sql/table.cc	Tue Apr 12 09:27:37 2005
+++ 1.161/sql/table.cc	Thu May  5 15:46:46 2005
@@ -1644,7 +1644,8 @@
         */
         tbl->ancestor->set_ancestor();
       }
-      tbl->table->grant= grant;
+      if (tbl->table)
+        tbl->table->grant= grant;
     } while ((tbl= tbl->next_local));
 
     /* if view contain only one table, substitute TABLE of it */

--- 1.78/mysql-test/r/view.result	Fri Apr 22 22:13:42 2005
+++ 1.79/mysql-test/r/view.result	Thu May  5 15:46:45 2005
@@ -1712,3 +1712,74 @@
 3	3	3	3
 drop view v1, v2;
 drop table t1, t2, t3;
+create table t1(f1 char(0), f2 decimal (64) unsigned not null DEFAULT 9.9,
+f3 tinyint, f5 int);
+Warnings:
+Note	1265	Data truncated for column 'f2' at row 1
+create table t2(f4 char binary, f5 int);
+insert into t1(f2,f3,f5) values(1,1,1),(2,2,2),(3,3,0),(4,4,4),(5,5,5),(6,6,6),
+(7,7,0),(8,8,8),(9,9,9),(10,10,10);
+insert into t2 values('a',1),('a',2),('a',0),('a',4),('a',5),('a',6),
+('a',0),('a',8),('a',9),('a',10);
+create algorithm=merge view v1 as select t1.f1, t1.f2, t1.f3, t2.f4, t2.f5
+from t1 inner join t2 using (f5);
+create algorithm=merge view v2 as select t1.f1, t1.f2, t1.f3, t2.f4, t2.f5
+from t1 inner join t2 using (f5);
+create algorithm=merge view v3 as select v1.f1, v1.f2, v1.f3, v2.f4, v2.f5
+from v1 inner join v2 using (f5);
+select * from v1;
+f1	f2	f3	f4	f5
+NULL	1	1	a	1
+NULL	2	2	a	2
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	4	4	a	4
+NULL	5	5	a	5
+NULL	6	6	a	6
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	8	8	a	8
+NULL	9	9	a	9
+NULL	10	10	a	10
+select * from v2;
+f1	f2	f3	f4	f5
+NULL	1	1	a	1
+NULL	2	2	a	2
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	4	4	a	4
+NULL	5	5	a	5
+NULL	6	6	a	6
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	8	8	a	8
+NULL	9	9	a	9
+NULL	10	10	a	10
+select * from v3;
+f1	f2	f3	f4	f5
+NULL	1	1	a	1
+NULL	2	2	a	2
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	4	4	a	4
+NULL	5	5	a	5
+NULL	6	6	a	6
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	3	3	a	0
+NULL	7	7	a	0
+NULL	8	8	a	8
+NULL	9	9	a	9
+NULL	10	10	a	10
+drop view v1, v2, v3;
+drop table t1, t2;

--- 1.67/mysql-test/t/view.test	Fri Apr 22 22:13:42 2005
+++ 1.68/mysql-test/t/view.test	Thu May  5 15:46:45 2005
@@ -1533,3 +1533,35 @@
 drop view v1, v2;
 drop table t1, t2, t3;
 
+#
+# Bug#9842 - Views:Any operation on a view created with merge option crashes mysql
service.
+#
+create table t1(f1 char(0), f2 decimal (64) unsigned not null DEFAULT 9.9,
+                f3 tinyint, f5 int);
+create table t2(f4 char binary, f5 int);
+#
+insert into t1(f2,f3,f5) values(1,1,1),(2,2,2),(3,3,0),(4,4,4),(5,5,5),(6,6,6),
+                               (7,7,0),(8,8,8),(9,9,9),(10,10,10);
+insert into t2 values('a',1),('a',2),('a',0),('a',4),('a',5),('a',6),
+                     ('a',0),('a',8),('a',9),('a',10);
+#
+# Now create three views:
+#
+create algorithm=merge view v1 as select t1.f1, t1.f2, t1.f3, t2.f4, t2.f5
+       from t1 inner join t2 using (f5);
+#
+create algorithm=merge view v2 as select t1.f1, t1.f2, t1.f3, t2.f4, t2.f5
+       from t1 inner join t2 using (f5);
+#
+create algorithm=merge view v3 as select v1.f1, v1.f2, v1.f3, v2.f4, v2.f5
+       from v1 inner join v2 using (f5);
+#
+# Now using the select statement list the values from each view:
+#
+select * from v1;
+select * from v2;
+select * from v3;
+#
+drop view v1, v2, v3;
+drop table t1, t2;
+
Thread
bk commit into 5.0 tree (ingo:1.1912) BUG#9842ingo5 May