List:Internals« Previous MessageNext Message »
From:igor Date:August 12 2005 10:27am
Subject:bk commit into 5.0 tree (igor:1.1983) BUG#12470
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
  1.1983 05/08/12 01:27:04 igor@stripped +3 -0
  sql_base.cc:
    Fixed bug #12470.
    A misplaced initialization of the cond_count counter
    resulted in a wrong calculation of it. This caused a memory
    corruption since this counter was used as a parameter of
    some memory allocation.
  view.test:
    Added a test case for bug #12470.

  sql/sql_base.cc
    1.279 05/08/12 01:21:49 igor@stripped +1 -1
    Fixed bug #12470.
    A misplaced initialization of the cond_count counter
    resulted in a wrong calculation of it. This caused a memory
    corruption since this counter was used as a parameter of
    some memory allocation.

  mysql-test/r/view.result
    1.102 05/08/12 01:19:21 igor@stripped +13 -0

  mysql-test/t/view.test
    1.96 05/08/12 01:18:48 igor@stripped +17 -0
    Added a test case for bug #12470.

# 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.0-0

--- 1.278/sql/sql_base.cc	Thu Aug 11 15:45:52 2005
+++ 1.279/sql/sql_base.cc	Fri Aug 12 01:21:49 2005
@@ -3660,6 +3660,7 @@
     arena= 0;                                   // For easier test
 
   thd->set_query_id=1;
+  select_lex->cond_count= 0;
 
   for (table= tables; table; table= table->next_local)
   {
@@ -3667,7 +3668,6 @@
       goto err_no_arena;
   }
 
-  select_lex->cond_count= 0;
   if (*conds)
   {
     thd->where="where clause";

--- 1.101/mysql-test/r/view.result	Thu Aug 11 15:45:26 2005
+++ 1.102/mysql-test/r/view.result	Fri Aug 12 01:19:21 2005
@@ -2079,3 +2079,16 @@
 2	foo2
 DROP VIEW v1;
 DROP TABLE t1;
+CREATE TABLE t1 (pk int PRIMARY KEY, b int);
+CREATE TABLE t2 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
+CREATE TABLE t3 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
+CREATE TABLE t4 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
+CREATE TABLE t5 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
+CREATE VIEW v1 AS
+SELECT t1.pk as a FROM t1,t2,t3,t4,t5
+WHERE t1.b IS NULL AND
+t1.pk=t2.fk AND t2.pk=t3.fk AND t3.pk=t4.fk AND t4.pk=t5.fk;
+SELECT a FROM v1;
+a
+DROP VIEW v1;
+DROP TABLE t1,t2,t3,t4,t5;

--- 1.95/mysql-test/t/view.test	Thu Aug 11 15:44:09 2005
+++ 1.96/mysql-test/t/view.test	Fri Aug 12 01:18:48 2005
@@ -1917,6 +1917,23 @@
 DROP VIEW v1;
 DROP TABLE t1;
 
+#
+# Test for bug #12470: crash for a simple select from a view defined
+#                      as a join over 5 tables
 
+CREATE TABLE t1 (pk int PRIMARY KEY, b int);
+CREATE TABLE t2 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
+CREATE TABLE t3 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
+CREATE TABLE t4 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
+CREATE TABLE t5 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
+CREATE VIEW v1 AS
+  SELECT t1.pk as a FROM t1,t2,t3,t4,t5
+    WHERE t1.b IS NULL AND
+          t1.pk=t2.fk AND t2.pk=t3.fk AND t3.pk=t4.fk AND t4.pk=t5.fk;
+
+SELECT a FROM v1;
+
+DROP VIEW v1;
+DROP TABLE t1,t2,t3,t4,t5;
 
 
Thread
bk commit into 5.0 tree (igor:1.1983) BUG#12470igor12 Aug