List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:May 10 2006 2:13pm
Subject:bk commit into 5.0 tree (svoj:1.2117) BUG#18233
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of svoj. When svoj 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.2117 06/05/10 17:13:02 svoj@april.(none) +3 -0
  BUG#18233 - Memory tables INDEX USING HASH (a,b) returns 1 row on
              SELECT WHERE a= AND b=
  
  Selecting data from memory table with varchar column and hash index over it
  returns only first row matched.
  
  The problem was that key was copied partialy into lastkey. It used
  keyinfo->length instead of actual key length. Before true varchar support
  for memory engine was implemented keyinfo->length was always equal to actual
  key length, but it is not true for keys over varchar columns anymore.
  
  This fix makes key to be copied into lastkey using actual key length.

  mysql-test/t/heap_hash.test
    1.12 06/05/10 17:12:58 svoj@april.(none) +8 -0
    Testcase for BUG#18233.

  mysql-test/r/heap_hash.result
    1.20 06/05/10 17:12:58 svoj@april.(none) +6 -0
    Testcase for BUG#18233.

  heap/hp_rkey.c
    1.16 06/05/10 17:12:58 svoj@april.(none) +1 -1
    Copy key_len bytes of key into lastkey. This fixes broken lastkey for
    indexes over varchar columns.

# 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:	svoj
# Host:	april.(none)
# Root:	/home/svoj/devel/mysql/BUG18233/mysql-5.0

--- 1.15/heap/hp_rkey.c	2004-12-18 07:19:14 +04:00
+++ 1.16/heap/hp_rkey.c	2006-05-10 17:12:58 +05:00
@@ -65,7 +65,7 @@
       DBUG_RETURN(my_errno);
     }
     if (!(keyinfo->flag & HA_NOSAME) || (keyinfo->flag & HA_END_SPACE_KEY))
-      memcpy(info->lastkey, key, (size_t) keyinfo->length);
+      memcpy(info->lastkey, key, (size_t) key_len);
   }
   memcpy(record, pos, (size_t) share->reclength);
   info->update= HA_STATE_AKTIV;

--- 1.19/mysql-test/r/heap_hash.result	2006-02-03 01:07:26 +04:00
+++ 1.20/mysql-test/r/heap_hash.result	2006-05-10 17:12:58 +05:00
@@ -366,3 +366,9 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	a	a	5	NULL	4	Using where
 drop table t1;
+CREATE TABLE t1(a VARCHAR(1), KEY(a)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('a'),('a');
+SELECT * FROM t1 WHERE a='a';
+a
+a
+a

--- 1.11/mysql-test/t/heap_hash.test	2005-07-28 18:12:34 +05:00
+++ 1.12/mysql-test/t/heap_hash.test	2006-05-10 17:12:58 +05:00
@@ -260,4 +260,12 @@
 explain select a from t1 where a in (1,3);
 drop table t1;
 
+#
+# BUG#18233 - Memory tables INDEX USING HASH (a,b) returns 1 row on
+#             SELECT WHERE a= AND b=
+#
+CREATE TABLE t1(a VARCHAR(1), KEY(a)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES('a'),('a');
+SELECT * FROM t1 WHERE a='a';
+
 # End of 4.1 tests
Thread
bk commit into 5.0 tree (svoj:1.2117) BUG#18233Sergey Vojtovich10 May