List:Internals« Previous MessageNext Message »
From:igor Date:March 5 2005 5:24am
Subject:bk commit into 4.1 tree (igor:1.2083) BUG#8893
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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.2083 05/03/04 20:24:13 igor@stripped +4 -0
  logging_ok:
    Logging to logging@stripped accepted
  func_group.result, func_group.test:
    Added a test case for bug #8893.
  opt_sum.cc:
    A misplaced initialization for the returned parameter
    prefix_len in the function find_key_for_maxmin caused
    usage of a wrong key prefix by the min/max optimization
    in cases when the matching index was not the first index
    that contained the min/max field.

  BitKeeper/etc/logging_ok
    1.365 05/03/04 20:21:44 igor@stripped +1 -0
    Logging to logging@stripped accepted

  mysql-test/r/func_group.result
    1.37 05/03/04 20:18:40 igor@stripped +26 -0
    Added a test case for bug #8893.

  mysql-test/t/func_group.test
    1.29 05/03/04 20:17:49 igor@stripped +30 -0
    Added a test case for bug #8893.

  sql/opt_sum.cc
    1.42 05/03/04 20:13:42 igor@stripped +1 -1
    A misplaced initialization for the returned parameter
    prefix_len in the function find_key_for_maxmin caused
    usage of a wrong key prefix by the min/max optimization
    in cases when the matching index was not the first index
    that contained the min/max field.

# 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:	linux.local
# Root:	/home/igor/dev/mysql-4.1-0

--- 1.41/sql/opt_sum.cc	Wed Sep 15 23:46:19 2004
+++ 1.42/sql/opt_sum.cc	Fri Mar  4 20:13:42 2005
@@ -624,7 +624,6 @@
 {
   if (!(field->flags & PART_KEY_FLAG))
     return 0;                                        // Not key field
-  *prefix_len= 0;
 
   TABLE *table= field->table;
   uint idx= 0;
@@ -637,6 +636,7 @@
     KEY_PART_INFO *part,*part_end;
     key_part_map key_part_to_use= 0;
     uint jdx= 0;
+    *prefix_len= 0;
     for (part= keyinfo->key_part, part_end= part+keyinfo->key_parts ;
          part != part_end ;
          part++, jdx++, key_part_to_use= (key_part_to_use << 1) | 1)

--- 1.364/BitKeeper/etc/logging_ok	Fri Feb 25 03:47:08 2005
+++ 1.365/BitKeeper/etc/logging_ok	Fri Mar  4 20:21:44 2005
@@ -67,6 +67,7 @@
 hf@stripped
 hf@genie.(none)
 igor@stripped
+igor@stripped
 igor@stripped
 ingo@stripped
 jan@stripped

--- 1.36/mysql-test/r/func_group.result	Mon Feb 28 06:11:15 2005
+++ 1.37/mysql-test/r/func_group.result	Fri Mar  4 20:18:40 2005
@@ -754,3 +754,29 @@
 Field	Type	Null	Key	Default	Extra
 f2	datetime			0000-00-00 00:00:00	
 drop table t2, t1;
+CREATE TABLE t1(
+id int PRIMARY KEY,
+a  int,
+b  int,
+INDEX i_b_id(a,b,id),
+INDEX i_id(a,id)
+);
+INSERT INTO t1 VALUES 
+(1,1,4), (2,2,1), (3,1,3), (4,2,1), (5,1,1);
+SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
+MAX(id)
+NULL
+DROP TABLE t1;
+CREATE TABLE t1(
+id int PRIMARY KEY,
+a  int,
+b  int,
+INDEX i_id(a,id),
+INDEX i_b_id(a,b,id)
+);
+INSERT INTO t1 VALUES 
+(1,1,4), (2,2,1), (3,1,3), (4,2,1), (5,1,1);
+SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
+MAX(id)
+NULL
+DROP TABLE t1;

--- 1.28/mysql-test/t/func_group.test	Mon Feb 28 06:11:15 2005
+++ 1.29/mysql-test/t/func_group.test	Fri Mar  4 20:17:49 2005
@@ -496,3 +496,33 @@
 create table t2 select f2 from (select now() f2 from t1) a;
 show columns from t2;
 drop table t2, t1;
+
+#
+# Bug 8893: wrong result for min/max optimization with 2 indexes
+#
+
+CREATE TABLE t1(
+  id int PRIMARY KEY,
+  a  int,
+  b  int,
+  INDEX i_b_id(a,b,id),
+  INDEX i_id(a,id)
+);
+INSERT INTO t1 VALUES 
+  (1,1,4), (2,2,1), (3,1,3), (4,2,1), (5,1,1);
+SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
+DROP TABLE t1;
+
+# change the order of the last two index definitions
+
+CREATE TABLE t1(
+  id int PRIMARY KEY,
+  a  int,
+  b  int,
+  INDEX i_id(a,id),
+  INDEX i_b_id(a,b,id)
+);
+INSERT INTO t1 VALUES 
+  (1,1,4), (2,2,1), (3,1,3), (4,2,1), (5,1,1);
+SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
+DROP TABLE t1;
Thread
bk commit into 4.1 tree (igor:1.2083) BUG#8893igor5 Mar