MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:igor Date:November 26 2005 2:51am
Subject:bk commit into 5.0 tree (igor:1.2012) BUG#15106
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.2012 05/11/25 18:51:44 igor@stripped +3 -0
  Fixed bug #15106.
  A typo bug caused loss of a predicate of the form field=const in some cases.

  sql/item_cmpfunc.cc
    1.186 05/11/25 18:51:39 igor@stripped +1 -1
    Fixed bug #15106.
    A typo bug caused loss of a predicate of the form field=const in some cases.

  mysql-test/t/select.test
    1.93 05/11/25 18:51:39 igor@stripped +45 -0
    Added a test case for bug #15106.

  mysql-test/r/select.result
    1.114 05/11/25 18:51:39 igor@stripped +46 -0
    Added a test case for bug #15106.

# 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.185/sql/item_cmpfunc.cc	2005-11-20 10:47:00 -08:00
+++ 1.186/sql/item_cmpfunc.cc	2005-11-25 18:51:39 -08:00
@@ -3662,7 +3662,7 @@
       the multiple equality already contains a constant and its 
       value is  not equal to the value of c.
     */
-    add(const_item);
+    add(c);
   }
   cond_false|= item->cond_false;
 } 

--- 1.113/mysql-test/r/select.result	2005-11-25 07:53:49 -08:00
+++ 1.114/mysql-test/r/select.result	2005-11-25 18:51:39 -08:00
@@ -3291,3 +3291,49 @@
 30	1	30
 drop table t1;
 drop view v1, v2, v3;
+CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
+CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
+CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
+PRIMARY KEY(key_a,key_b));
+INSERT INTO t1 VALUES (0,'');
+INSERT INTO t1 VALUES (1,'i');
+INSERT INTO t1 VALUES (2,'j');
+INSERT INTO t1 VALUES (3,'k');
+INSERT INTO t2 VALUES (1,'r');
+INSERT INTO t2 VALUES (2,'s');
+INSERT INTO t2 VALUES (3,'t');
+INSERT INTO t3 VALUES (1,5,'x');
+INSERT INTO t3 VALUES (1,6,'y');
+INSERT INTO t3 VALUES (2,5,'xx');
+INSERT INTO t3 VALUES (2,6,'yy');
+INSERT INTO t3 VALUES (2,7,'zz');
+INSERT INTO t3 VALUES (3,5,'xxx');
+SELECT t2.key_a,foo 
+FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
+INNER JOIN t3 ON t1.key_a = t3.key_a
+WHERE t2.key_a=2 and key_b=5;
+key_a	foo
+2	xx
+EXPLAIN SELECT t2.key_a,foo 
+FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
+INNER JOIN t3 ON t1.key_a = t3.key_a
+WHERE t2.key_a=2 and key_b=5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	const	PRIMARY	PRIMARY	4	const	1	Using index
+1	SIMPLE	t2	const	PRIMARY	PRIMARY	4	const	1	Using index
+1	SIMPLE	t3	const	PRIMARY	PRIMARY	8	const,const	1	
+SELECT t2.key_a,foo 
+FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
+INNER JOIN t3 ON t1.key_a = t3.key_a
+WHERE t2.key_a=2 and key_b=5;
+key_a	foo
+2	xx
+EXPLAIN SELECT t2.key_a,foo 
+FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
+INNER JOIN t3 ON t1.key_a = t3.key_a
+WHERE t2.key_a=2 and key_b=5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	const	PRIMARY	PRIMARY	4	const	1	Using index
+1	SIMPLE	t2	const	PRIMARY	PRIMARY	4	const	1	Using index
+1	SIMPLE	t3	const	PRIMARY	PRIMARY	8	const,const	1	
+DROP TABLE t1,t2,t3;

--- 1.92/mysql-test/t/select.test	2005-11-25 02:42:46 -08:00
+++ 1.93/mysql-test/t/select.test	2005-11-25 18:51:39 -08:00
@@ -2760,3 +2760,48 @@
 select f1, f2, v3.f1 as x1 from v3 order by v3.f1;
 drop table t1;
 drop view v1, v2, v3;
+
+#
+# Bug #15106: lost equality predicate of the form field=const in a join query
+#
+
+CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
+CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
+CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
+                PRIMARY KEY(key_a,key_b));
+
+INSERT INTO t1 VALUES (0,'');
+INSERT INTO t1 VALUES (1,'i');
+INSERT INTO t1 VALUES (2,'j');
+INSERT INTO t1 VALUES (3,'k');
+
+INSERT INTO t2 VALUES (1,'r');
+INSERT INTO t2 VALUES (2,'s');
+INSERT INTO t2 VALUES (3,'t');
+
+INSERT INTO t3 VALUES (1,5,'x');
+INSERT INTO t3 VALUES (1,6,'y');
+INSERT INTO t3 VALUES (2,5,'xx');
+INSERT INTO t3 VALUES (2,6,'yy');
+INSERT INTO t3 VALUES (2,7,'zz');
+INSERT INTO t3 VALUES (3,5,'xxx');
+
+SELECT t2.key_a,foo 
+  FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
+          INNER JOIN t3 ON t1.key_a = t3.key_a
+    WHERE t2.key_a=2 and key_b=5;
+EXPLAIN SELECT t2.key_a,foo 
+  FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
+          INNER JOIN t3 ON t1.key_a = t3.key_a
+    WHERE t2.key_a=2 and key_b=5;
+
+SELECT t2.key_a,foo 
+  FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
+          INNER JOIN t3 ON t1.key_a = t3.key_a
+    WHERE t2.key_a=2 and key_b=5;
+EXPLAIN SELECT t2.key_a,foo 
+  FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
+          INNER JOIN t3 ON t1.key_a = t3.key_a
+    WHERE t2.key_a=2 and key_b=5;
+
+DROP TABLE t1,t2,t3;
Thread
bk commit into 5.0 tree (igor:1.2012) BUG#15106igor26 Nov